Saturday, August 29, 2009

C++-FIBONACCI SERIES

#include
#include

main()
{
const unsigned long limit=4294967295;
unsigned long next=0;
unsigned long last=1;
long sum;

clrscr();

cout<<"\n\n This program will print the Fibonacci series :\n\n ";
while(next {
cout< sum=next+last;
next=last;
last=sum;
}
getch();
}

C++ CALCULATOR

#include
#include
using namespace std;
float mult(float num1,float num2);
float add(float num1,float num2);
float sub(float num1,float num2);
float divide(float num2,float num2);
int main()
{
int choice;
float num1,num2;
cout<<"---------------------------------------------"< cout<<" CALCULATOR"< cout<<"---------------------------------------------"< cout<<" Make a selection:"< cout<<" 1.Division"< cout<<" 2.Adding"< cout<<" 3.Subtraction"< cout<<" 4.multiplication"< cout<<"
YOUR CHIOCE IS: ";
cin>>choice;
switch(choice)
{
case 1:
cout<<"Enter the two numbers you want to divide, divisor first!: ";
cin>>num1>> num2;
cin.ignore();
cout<<" "< cin>>num1>> num2;
cin.ignore();
cout<<" "< break;
case 3:
cout<<"Enter the two numbers you want to subtract”;
cin>>num1>> num2;
cin.ignore();
cout<<" "< break;
case 4:
cout<<"Enter the two numbers you want to multiply: ";
cin>>num1>>num2;
cin.ignore();
cout<<" "< break;
default:
cout<<"Invalid Entry!"< cin.ignore();
break;
}
cin.ignore();
return 0;
}
float mult(float num1,float num2)
{
return (num1*num2);
}
float add(float num1,float num2)
{
return (num1+num2);
}
float sub(float num1,float num2)
{
return (num1-num2);
}
float divide(float num1,float num2)
{
return (num1/num2);
}

Followers