I'm currently working on a code to use imbedded if functions....
Its kicking my butt now, I lost about an hours worth of tweaking and now I'm... bumbling around like an idiot. Let me show you my errors and then We'll move on to my mess of a code.
In function 'Int main()'
expected ) before ! token --- line 160
[ C:\WINDOWS\Desktop\MUD\Dev-Cpp\G__~1.EXE If Challenge Help.o: No such file or directory.
C:\WINDOWS\Desktop\MUD\Dev-Cpp\G__~1.EXE no input files ] x2
I know its a mess, Ever since I lost my work, My brain has been .. jumbled and I can't figure out how I had it worked outCode:#include <iostream> using namespace std; int main() { for (int i = 0; i < 10; i++ ) { int books; int input; cout<<"How many books have you read this last year?\n"; cin>> books; cin.ignore(); cout<<"You read "<< books <<"?\n"; if ( books >= 90 ) { cout<<"Listed below are your options:\n"; cout<<" a : 42' Tv Set!\n"; cout<<" b : MP3 Player!\n"; cout<<" c : Sony Cd Player!\n"; cout<<" d : Book Subscription!\n"; cout<<" e : A peice of Candy!\n"; cin>> input; if ( input == 'a' ) { cout<<"Wow! Congratulations! You've won a 42' Tv Set!\n"; cin.get(); } else if ( input == 'b' ) { cout<<"Good Job! You've won an MP3 player!\n"; cin.get(); } else if ( input == 'c' ) { cout<<"The work paid off! You've won a Sony CD player!\n"; cin.get(); } else if ( input == 'd' ) { cout<<"This'll help you boost your score! Your very own National Book Club Subscription!\n"; cin.get(); } else if ( input == 'e' ) { cout<<"Here is some candy, maybe it will boost your brain power!\n"; cin.get(); } else if ( input != 'a' || input != 'b' || input != 'c' || input != 'd' || input != 'e' ) { cout<<"Error. Please enter a, b, c, d, or e\n"; cin.get(); } else if ( books >= 75 ) { cout<<"Listed below are your options:\n"; cout<<" b : MP3 Player!\n"; cout<<" c : Sony Cd Player!\n"; cout<<" d : Book Subscription!\n"; cout<<" e : A peice of Candy!\n"; cin>> input;\ if ( input == 'b' ) { cout<<"Good Job! You've won an MP3 player!\n"; cin.get(); } else if ( input == 'c' ) { cout<<"The work paid off! You've won a Sony CD player!\n"; cin.get(); } else if ( input == 'd' ) { cout<<"This'll help you boost your score! Your very own National Book Club Subscription!\n"; cin.get(); } else if ( input == 'e' ) { cout<<"Here is some candy, maybe it will boost your brain power!\n"; cin.ignore(); } else if ( input != 'b' || input != 'c' || input != 'd' || input != 'e' ) { cout<<"Error. Please enter a, b, c, d, or e\n"; cin.get(); } cin.get(); } else if ( books >= 50 ) { cout<<"Listed below are your options:\n"; cout<<" c : Sony Cd Player!\n"; cout<<" d : Book Subscription!\n"; cout<<" e : A peice of Candy!\n"; cin>> input; if ( input == 'c' ) { cout<<"The work paid off! You've won a Sony CD player!\n"; cin.get(); } else if ( input == 'd' ) { cout<<"This'll help you boost your score! Your very own National Book Club Subscription!\n"; cin.get(); } else if ( input == 'e' ) { cout<<"Here is some candy, maybe it will boost your brain power!\n"; cin.ignore(); } else if ( input != 'c' || input != 'd' || input != 'e' ) { cout<<"Error. Please enter a, b, c, d, or e\n"; cin.get(); } cin.get(); } else if ( books >= 25 ) { cout<<"Listed below are your options:\n"; cout<<" d : Book Subscription!\n"; cout<<" e : A peice of Candy!\n"; cin>> input; if ( input == 'd' ) { cout<<"This'll help you boost your score! Your very own National Book Club Subscription!\n"; cin.ignore(); } else if ( input == 'e' ) { cout<<"Here is some candy, maybe it will boost your brain power!\n"; cin.ignore(); } else if ( input != 'd' || input != 'e' ) { cout<<"Error. Please enter a, b, c, d, or e\n"; cin.get(); } cin.get(); } else if ( books >= 1 ) { cout<<"Listed below are your options:\n"; cout<<" e : A peice of Candy!\n"; cin>> input; if ( input == 'e' ) { cout<<"Here is some candy, maybe it will boost your brain power!\n"; cin.get(); } cin.get(); } else if ( books == 0 ) { cout<<"Listed below are your options:\n"; cout<<"Sorry, Start reading and maybe you'll win something next time!\n"; } else if ( books != 0 && books !> 0 || books < 0 ) { cout<<"Error. Please enter a positive integer.\n"; cin.get(); } cin.get();



LinkBack URL
About LinkBacks




