AmalgaNation

A Forum For Fans of All Audio-Visual Media

Members are requested to always regularly check the "Announcements" Section.
An IRC webchat has been placed at the bottom of the portal page. Type in a name and enter. This way, you do not need a IRC client, just open the portal page. No logging into forum account needed.

You are not connected. Please login or register

Stupid Program

Go down  Message [Page 1 of 1]

20091028

Stupid Program

Aceviper

avatar
Administrator
Administrator
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.


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


______________________________________________
View user profile
Share this post on: diggdeliciousredditstumbleuponslashdotyahoogooglelive

Post on Sun Dec 20, 2009 3:14 pm by Guest

sorry to say but ur programs aren't any good...i thought fibonacci series and factorial were easy programs...if u want then i can upload mine...

avatar

Post on Sun Dec 20, 2009 6:38 pm by Aceviper

Lol dude. These were programs I wrote three months ago. I know better now. Smile

Fibbonaci and factorial are the least of my problems in C++

Post on Sun Dec 20, 2009 6:59 pm by Guest

Aceviper wrote:I know better now. Smile

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....

avatar

Post on Sun Dec 20, 2009 7:18 pm by Aceviper

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.

avatar

Post on Fri Apr 08, 2011 4:49 pm by FlamingStar

the factorial one gave me a good laugh..... Razz
we don't have to deal with programs much...we have to by heart theories!!!! Shocked
that is the cruelest part of all.... Neutral

avatar

Post on Thu Apr 14, 2011 2:51 pm by BloodAlchemist

omg...that program was just horrible......

Post  by Sponsored content

Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum