Ok guys, I just started a c++ class a couple of months ago, and I am writting a program for the class. This, I'm sure, is an EASY debugging question, but I still have one error that keeps on coming up. My one and only error is "While statement missin ) ". Oviously, it is associated with my while statement. Here is the code for it, I'm using borland 5.02. And the error is with the line that starts out as "while {((drill='Y')||(drill='y'))".
/* , computer science period 2*/
#include <iostream.h>
#include <conio.h>
#include <stdlib.h>
int main ()
{
int r1, r2, r3, r4, r5, r6;
char drill;
cout<<"Hello, how are you? This is Will Powers Golf game analyzer."<<endl;
cout<<"This analizer will tell you how good you are at golf."<<endl<<endl<<endl<<endl;
cout<<"Here is how the game will work: "<<endl;
cout<<"\tEnter in the scores for the last five 9 hole rounds you have played."<<endl;
cout<<"\tThe program will tell you what your average is."<<endl;
cout<<"\tThe program will tell you how good you are."<<endl;
cout<<"\tThe program will offer any tips on how to improve, if you want"<<endl;
cout<<endl<<endl;
cout<<"You are about to start."<<endl<<endl<<endl;
cout<<"Enter in the score for the last 9 hole round you have played: ";
cin>>r1;
cout<<endl;
cout<<"Enter your score for the 9 hole round before that: ";
cin>>r2;
cout<<endl;
cout<<"Enter your score for the 9 hole round before that: ";
cin>>r3;
cout<<endl;
cout<<"Enter your score for the 9 hole round before that: ";
cin>>r4;
cout<<endl;
cout<<"Enter your score for the 9 hole round before that: ";
cin>>r5;
cout<<endl;
cout<<"Enter your score for the 9 hole round before that: ";
cin>>r6;
cout<<endl<<endl<<endl;
cout<<"Your 9 hole average is "<<((r1+r2+r3+r4+r5+r6)/6)<<" for the last 6 rounds.";
int num=r1+r2+r3+r4+r5+r6;
cout<<endl<<endl<<endl;
if (num <40)
cout<<"Your a very good player";
else if ((num >= 40)&& (num <= 45))
cout<<"You have skill, keep at it and you'll be a first class player";
else if ((num >= 46)&& (num <= 50))
cout<<"You show potential, I would spend time at the range.";
else if ((num >= 51)&& (num <= 60))
cout<<"I would definitly put many hours into your game.";
else
cout<<"Get professional lessons.";
cout<<endl<<endl<<endl<<endl;
cout<<"Would like some ideas of the kind of drills you should be doing?(Y/N)";
cin>>drill;
while{((drill='Y')||(drill='y'))
cout<<"What part of your game would you like to improve?"<<endl<<endl;
cout<<"\t**********************************************";
cout<<"\t* Choice Press *";
cout<<"\t* ---------- ------ *";
cout<<"\t* Putting P *";
cout<<"\t* Chipping C *";
cout<<"\t* Driving D *";
cout<<"\t* Iron Shots I *";
cout<<"\t**********************************************";
cin>>drill;
if ((drill='P')||(drill='p'))
cout<<"There are several good drills you can do to improve your putting./n/n";
cout<<"First, go to a big putting green and get 10 balls, and put them on a line";
cout<<" going backwords, each ball being 6 inches behind the other. You might also";
cout<<" want to go to your local library and get a book on putting techniques.";
else if ((drill='C')||(drill='c'))
cout<<"There are several good drills you can do to improve your, the best one being";
cout<<" just like the putting drill. Get a small bucket of balls from a local driving";
cout<<" range, go to that ranges chipping green, go about 40 feet away from the chipping";
cout<<" green, and line up all the balls a few inches behind each other. You might also";
cout<<" want to go to your local library and get a book on chipping techniques.";
else if ((drill='D')||(drill='d'))
cout<<"Driving is a little more complicated than putting and chipping drills. There are ";
cout<<"several ways to go about getting better at driving. The best way would to get a couple";
cout<<" of lessons from an instructor, and then to practice that everyday at your local driving";
cout<<" range. That can get very expensive, so another way to get better would to get an ";
cout<<"instructional video of Driving techniques.";
else if ((drill='I')||(drill='i'))
cout<<"Iron shots are the most complicated shots to learn. There are ";
cout<<"several ways to go about getting better at your Iron shots. The best way would ";
cout<<"to get a couple of lessons from an instructor,";
cout<<" and then to practice that everyday at your local driving";
cout<<" range. That can get very expensive, so another way to ";
cout<<"get better would to get an instructional video of Iron shot techniques.";
else
cout<<"You entered an invalid letter, please restart the program.";
}
while ((drill!='y')||(drill!='Y')){
cout<<"Thanks for using my program, have a nice day.";
}
getche();
return (0);
}
/* , computer science period 2*/
#include <iostream.h>
#include <conio.h>
#include <stdlib.h>
int main ()
{
int r1, r2, r3, r4, r5, r6;
char drill;
cout<<"Hello, how are you? This is Will Powers Golf game analyzer."<<endl;
cout<<"This analizer will tell you how good you are at golf."<<endl<<endl<<endl<<endl;
cout<<"Here is how the game will work: "<<endl;
cout<<"\tEnter in the scores for the last five 9 hole rounds you have played."<<endl;
cout<<"\tThe program will tell you what your average is."<<endl;
cout<<"\tThe program will tell you how good you are."<<endl;
cout<<"\tThe program will offer any tips on how to improve, if you want"<<endl;
cout<<endl<<endl;
cout<<"You are about to start."<<endl<<endl<<endl;
cout<<"Enter in the score for the last 9 hole round you have played: ";
cin>>r1;
cout<<endl;
cout<<"Enter your score for the 9 hole round before that: ";
cin>>r2;
cout<<endl;
cout<<"Enter your score for the 9 hole round before that: ";
cin>>r3;
cout<<endl;
cout<<"Enter your score for the 9 hole round before that: ";
cin>>r4;
cout<<endl;
cout<<"Enter your score for the 9 hole round before that: ";
cin>>r5;
cout<<endl;
cout<<"Enter your score for the 9 hole round before that: ";
cin>>r6;
cout<<endl<<endl<<endl;
cout<<"Your 9 hole average is "<<((r1+r2+r3+r4+r5+r6)/6)<<" for the last 6 rounds.";
int num=r1+r2+r3+r4+r5+r6;
cout<<endl<<endl<<endl;
if (num <40)
cout<<"Your a very good player";
else if ((num >= 40)&& (num <= 45))
cout<<"You have skill, keep at it and you'll be a first class player";
else if ((num >= 46)&& (num <= 50))
cout<<"You show potential, I would spend time at the range.";
else if ((num >= 51)&& (num <= 60))
cout<<"I would definitly put many hours into your game.";
else
cout<<"Get professional lessons.";
cout<<endl<<endl<<endl<<endl;
cout<<"Would like some ideas of the kind of drills you should be doing?(Y/N)";
cin>>drill;
while{((drill='Y')||(drill='y'))
cout<<"What part of your game would you like to improve?"<<endl<<endl;
cout<<"\t**********************************************";
cout<<"\t* Choice Press *";
cout<<"\t* ---------- ------ *";
cout<<"\t* Putting P *";
cout<<"\t* Chipping C *";
cout<<"\t* Driving D *";
cout<<"\t* Iron Shots I *";
cout<<"\t**********************************************";
cin>>drill;
if ((drill='P')||(drill='p'))
cout<<"There are several good drills you can do to improve your putting./n/n";
cout<<"First, go to a big putting green and get 10 balls, and put them on a line";
cout<<" going backwords, each ball being 6 inches behind the other. You might also";
cout<<" want to go to your local library and get a book on putting techniques.";
else if ((drill='C')||(drill='c'))
cout<<"There are several good drills you can do to improve your, the best one being";
cout<<" just like the putting drill. Get a small bucket of balls from a local driving";
cout<<" range, go to that ranges chipping green, go about 40 feet away from the chipping";
cout<<" green, and line up all the balls a few inches behind each other. You might also";
cout<<" want to go to your local library and get a book on chipping techniques.";
else if ((drill='D')||(drill='d'))
cout<<"Driving is a little more complicated than putting and chipping drills. There are ";
cout<<"several ways to go about getting better at driving. The best way would to get a couple";
cout<<" of lessons from an instructor, and then to practice that everyday at your local driving";
cout<<" range. That can get very expensive, so another way to get better would to get an ";
cout<<"instructional video of Driving techniques.";
else if ((drill='I')||(drill='i'))
cout<<"Iron shots are the most complicated shots to learn. There are ";
cout<<"several ways to go about getting better at your Iron shots. The best way would ";
cout<<"to get a couple of lessons from an instructor,";
cout<<" and then to practice that everyday at your local driving";
cout<<" range. That can get very expensive, so another way to ";
cout<<"get better would to get an instructional video of Iron shot techniques.";
else
cout<<"You entered an invalid letter, please restart the program.";
}
while ((drill!='y')||(drill!='Y')){
cout<<"Thanks for using my program, have a nice day.";
}
getche();
return (0);
}