This is a Hitskin.com skin preview
Install the skin • Return to the skin page
Stupid Program
Page 1 of 1
20091028
Stupid Program
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
Aceviper- Administrator
- Posts : 783
Points : 1168
Reputation : 15
Birthday : 1991-05-09
Join date : 2009-05-18
Age : 32
Location : Bombay
Stupid Program :: Comments
Lol dude. These were programs I wrote three months ago. I know better now.
Fibbonaci and factorial are the least of my problems in C++
Fibbonaci and factorial are the least of my problems in C++
Aceviper wrote:I know better now.
Fibbonaci and factorial are the least of my problems in C++
thats good to here....computer programs are initially hard...i still am facing the "array" problem...guess i'll have to practice more....
Arrays are something I'm quite familiar with now - might just be able to lend you a hand if I can. Better choice would be Die Hard, though.
the factorial one gave me a good laugh.....
we don't have to deal with programs much...we have to by heart theories!!!!
that is the cruelest part of all....
we don't have to deal with programs much...we have to by heart theories!!!!
that is the cruelest part of all....
Permissions in this forum:
You cannot reply to topics in this forum
|
|