Friday, January 27, 2012

Lisp Program to Print Fibonocci Series upto a user specified Limit

The following is a lisp program to print the Fibonacci series up to a user specified limit.

 (defun fibonacci()  
 (format t "Enter the limit : ")  
 (setf n(read))  
 (format t "Fibonacci Series : ")  
 (format t "0 1")  
 (setf a 0)  
 (setf b 1)  
 (do ((i 3(+ i 1))) ((> i n))  
  (setf c (+ a b))  
  (format t " ~d" c)  
  (setf a b)  
  (setf b c)))  

The folowing program produces the Output

OUTPUT

Enter the limit : 8
Fibonacci Series  : 0 1 1 2 3 5 8 13


Do you Really need a Tablet?Tablet vs SmartPhone vs Laptop

Tablets have become most common in today's market that people see it as necessary gadget.Have ever you wondered why you need a tablet or Do you even need a tablet?
If you have a laptop or a smartphone do you need to buy a tablet.Get the answers below.


                        Laptop vs Tablet vs SmartPhone


You Should decide if you need one by taking into account of the intended usage.It also depends on you and your habits.


Videos/Multimedia:
Most tablets offer a decent 5-10 Inch Screen Size,which allows you to watch HD Videos,Photos Easily and Comfortably rather than straining your eyes on the small screen of a smartphone.So tablets are way ahead when compared to smartphones in this aspect.But if you have a laptop apart from the portability and ease of use you can watch Videos or HD Content in it.So its your Call.


Document Viewing:
Viewing PDF's and Word Documents are much easier when compared to Smart Phones.But with Touch screen typing in will be a little harder,so here laptop is better if you let go of the portability.


Gaming:
 Tablets are not that into high end games moreover gaming in a touch screen may be a little annoying.


Surfing the Web:
If you have a WIFI Hotspot you can browse the web from anywhere,tablets offers ease of web surfing by allowing you to slide through the webpages with your fingers.Tablets stand out for Web browsing way ahead of laptops and smartphones.


So,The Conclusion?


Can a Tablet replace a Smart Phone?
Yes.Tablets are good alternatives to smartphones if you are looking for a device that is focused for multimedia applications like viewing Videos,Photos , Browsing the Web or Viewing PDF's or E books.

Can a Tablet replace a Laptop?
The answer is a No .You cannot do Programs or Develop applications on a tablet you might also find difficult editing images and Documents on a Touch Screen.But if you are using your laptop for Viewing Videos,Browsing the Internet or Reading E-Books then the Tablet is For you.






 

Thursday, January 12, 2012

Operator Overloading in C++ to add,substract,multiply and divide two Complex Numbers

Operator Overloading is a technique of polymorphism by which an operator(+,- etc) can be used to do different types of operations. eg:+ can be used to add two integers say a and b using sum=a+b similarly two floating point numbers say fa,fb by fs=fa+fb. In this example +,-,*,- operators are overloaded to add,subtract, multiply and divide two complex numbers. First a class named complex is created which has overloaded operators like + specified by a function 'complex operator +(complex c2)' which can used to add two complex numbers like c3=c1+c2 where c1,c2 and c3 are complex numbers.The complete source in C++ to implement operator overloading is provided below
 #include<iostream.h>  
 #include<conio.h>  
 class complex  
 {  
 int a,b;  
 public:  
 void read()  
 {  
 cout<<"\n\nEnter the REAL PART : ";  
 cin>>a;  
 cout<<"\n\nEnter the IMAGINARY PART : ";  
 cin>>b;  
 }  
 complex operator +(complex c2)  
 {  
 complex c3;  
 c3.a=a+c2.a;  
 c3.b=b+c2.b;  
 return c3;  
 }  
 complex operator -(complex c2)  
 {  
 complex c3;  
 c3.a=a-c2.a;  
 c3.b=b-c2.b;  
 return c3;  
 }  
 complex operator *(complex c2)  
 {  
 complex c3;  
 c3.a=(a*c2.a)-(b*c2.b);  
 c3.b=(b*c2.a)+(a*c2.b);  
 return c3;  
 }  
 complex operator /(complex c2)  
 {  
 complex c3;  
 c3.a=((a*c2.a)+(b*c2.b))/((c2.a*c2.a)+(c2.b*c2.b));  
 c3.b=((b*c2.a)-(a*c2.b))/((c2.a*c2.a)+(c2.b*c2.b));  
 return c3;  
 }  
 void display()  
 {  
 cout<<a<<"+"<<b<<"i";  
 }  
 };  
 void main()  
 {  
 complex c1,c2,c3;  
 int choice,cont;  
 do  
 {  
 clrscr();  
 cout<<"\t\tCOMPLEX NUMBERS\n\n1.ADDITION\n\n2.SUBTRACTION\n\n3.MULTIPLICATION\n\n4.DIVISION";  
 cout<<"\n\nEnter your choice : ";  
 cin>>choice;  
 if(choice==1||choice==2||choice==3||choice==4)  
 {  
 cout<<"\n\nEnter the First Complex Number";  
 c1.read();  
 cout<<"\n\nEnter the Second Complex Number";  
 c2.read();  
 }  
 switch(choice)  
 {  
 case 1     : c3=c1+c2;  
            cout<<"\n\nSUM = ";  
            c3.display();  
            break;  
 case 2     : c3=c1-c2;  
            cout<<"\n\nResult = ";  
            c3.display();  
            break;  
 case 3 : c3=c1*c2;  
            cout<<"\n\nPRODUCT = ";  
            c3.display();  
            break;  
 case 4     : c3=c1/c2;  
            cout<<"\n\nQOUTIENT = ";  
            c3.display();  
            break;  
 default     : cout<<"\n\nUndefined Choice";  
 }  
 cout<<"\n\nDo You Want to Continue?(1-Y,0-N)";  
 cin>>cont;  
 }while(cont==1);  
 getch();  
 }  

Which is the Best Photo Watermarking Software

Photo Theft is becoming more and more common in the web with the outburst of social websites like Facebook,Google Plus and Image sharing se...