Stupid Program
For all those who know C++. A hialrious program for you. I had to write a program to be able to find the Fibbonaci Series and find a factorial of a number. It was for my midterms, which I didn't study, and here it is-->
Aaah. I put most of my stuff on AmalgaNation first and then on Facebook, so this might be a second read for some of you.
Well, fibbonacci series was good, but she wanted it from 1 and not 0, so she cut my marks for that.
As for my factorial switch case...5 factoial comes out to be 15...so you know how bad THAT is! Lol.
I got 5 out of 8 marks for the program. And the best part is the Exit. You should try writing the program JUST to see the exit. Just remember the combination - ctrl+pause/break. You might get 6 warnings. Just ignore those and run the program.
For all those who know C++. A hialrious program for you. I had to write a program to be able to find the Fibbonaci Series and find a factorial of a number. It was for my midterms, which I didn't study, and here it is-->
Aaah. I put most of my stuff on AmalgaNation first and then on Facebook, so this might be a second read for some of you.
- Spoiler:
#include
#include
void main()
{
clrscr();
int ch,Y,y,a,b,n,i,c,l,m;
cout<<"Choices:"<<<"1. To Find Fibbonaci Series."< <<"2. To find Factorial"< <<"3. Exit? (Y/N)"<
do
{
cin>>ch;
switch(ch)
{
case 1:
c=1;
a=0;
b=1;
cout<<"Enter Value of number: ";
cin>>n;
cout<< <for(i=1;i<=n-2;i++)
{
a=a+c;
c=b;
b=a;
cout<}
break;
case 2:
cout<<"Enter Number";
cin>>n;
l=1;
m=2;
for(i=1;i<=n-1;i++)
{
l=l+m;
m++;
}
cout<cout< break;
case 3: int ans;
cout<<"Exit? (Y/N)";
cin>>ans;
if (ans==Y||ans==y)
break;
}
while(ch<=3)
}
getch();
}
Well, fibbonacci series was good, but she wanted it from 1 and not 0, so she cut my marks for that.
As for my factorial switch case...5 factoial comes out to be 15...so you know how bad THAT is! Lol.
I got 5 out of 8 marks for the program. And the best part is the Exit. You should try writing the program JUST to see the exit. Just remember the combination - ctrl+pause/break. You might get 6 warnings. Just ignore those and run the program.
Last edited by Aceviper on Wed Feb 24, 2010 1:23 am; edited 2 times in total