Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Very simple c++ debugging question, it won't compile

Status
Not open for further replies.

StriderF1

Programmer
Feb 18, 2001
3
US
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.

Code:
/* , 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<<&quot;Hello, how are you?  This is Will Powers Golf game analyzer.&quot;<<endl;
cout<<&quot;This analizer will tell you how good you are at golf.&quot;<<endl<<endl<<endl<<endl;
cout<<&quot;Here is how the game will work: &quot;<<endl;
cout<<&quot;\tEnter in the scores for the last five 9 hole rounds you have played.&quot;<<endl;
cout<<&quot;\tThe program will tell you what your average is.&quot;<<endl;
cout<<&quot;\tThe program will tell you how good you are.&quot;<<endl;
cout<<&quot;\tThe program will offer any tips on how to improve, if you want&quot;<<endl;
cout<<endl<<endl;
cout<<&quot;You are about to start.&quot;<<endl<<endl<<endl;

cout<<&quot;Enter in the score for the last 9 hole round you have played: &quot;;
cin>>r1;
cout<<endl;
cout<<&quot;Enter your score for the 9 hole round before that: &quot;;
cin>>r2;
cout<<endl;
cout<<&quot;Enter your score for the 9 hole round before that: &quot;;
cin>>r3;
cout<<endl;
cout<<&quot;Enter your score for the 9 hole round before that: &quot;;
cin>>r4;
cout<<endl;
cout<<&quot;Enter your score for the 9 hole round before that: &quot;;
cin>>r5;
cout<<endl;
cout<<&quot;Enter your score for the 9 hole round before that: &quot;;
cin>>r6;
cout<<endl<<endl<<endl;

cout<<&quot;Your 9 hole average is &quot;<<((r1+r2+r3+r4+r5+r6)/6)<<&quot; for the last 6 rounds.&quot;;
int num=r1+r2+r3+r4+r5+r6;
cout<<endl<<endl<<endl;

if (num <40)
	cout<<&quot;Your a very good player&quot;;
else if ((num >= 40)&& (num <= 45))
	cout<<&quot;You have skill, keep at it and you'll be a first class player&quot;;
else if ((num >= 46)&& (num <= 50))
	cout<<&quot;You show potential, I would spend time at the range.&quot;;
else if ((num >= 51)&& (num <= 60))
	cout<<&quot;I would definitly put many hours into your game.&quot;;
else
	cout<<&quot;Get professional lessons.&quot;;

cout<<endl<<endl<<endl<<endl;

cout<<&quot;Would like some ideas of the kind of drills you should be doing?(Y/N)&quot;;
cin>>drill;

while{((drill='Y')||(drill='y'))
		cout<<&quot;What part of your game would you like to improve?&quot;<<endl<<endl;
   	cout<<&quot;\t**********************************************&quot;;
   	cout<<&quot;\t*    Choice							  Press        *&quot;;
   	cout<<&quot;\t*    ----------                 ------       *&quot;;
   	cout<<&quot;\t*	  Putting                      P          *&quot;;
   	cout<<&quot;\t*    Chipping                     C          *&quot;;
   	cout<<&quot;\t*    Driving                      D          *&quot;;
   	cout<<&quot;\t*    Iron Shots                   I          *&quot;;
   	cout<<&quot;\t**********************************************&quot;;
   	cin>>drill;
      if ((drill='P')||(drill='p'))
   	cout<<&quot;There are several good drills you can do to improve your putting./n/n&quot;;
      cout<<&quot;First, go to a big putting green and get 10 balls, and put them on a line&quot;;
      cout<<&quot; going backwords, each ball being 6 inches behind the other.  You might also&quot;;
      cout<<&quot; want to go to your local library and get a book on putting techniques.&quot;;
   	else if  ((drill='C')||(drill='c'))
   	cout<<&quot;There are several good drills you can do to improve your, the best one being&quot;;
      cout<<&quot; just like the putting drill.  Get a small bucket of balls from a local driving&quot;;
      cout<<&quot; range, go to that ranges chipping green, go about 40 feet away from the chipping&quot;;
      cout<<&quot; green, and line up all the balls a few inches behind each other.  You might also&quot;;
      cout<<&quot; want to go to your local library and get a book on chipping techniques.&quot;;
   	else if ((drill='D')||(drill='d'))
   	cout<<&quot;Driving is a little more complicated than putting and chipping drills.  There are &quot;;
      cout<<&quot;several ways to go about getting better at driving.  The best way would to get a couple&quot;;
      cout<<&quot; of lessons from an instructor, and then to practice that everyday at your local driving&quot;;
      cout<<&quot; range.  That can get very expensive, so another way to get better would to get an &quot;;
      cout<<&quot;instructional video of Driving techniques.&quot;;
   	else if ((drill='I')||(drill='i'))
   	cout<<&quot;Iron shots are the most complicated shots to learn.  There are &quot;;
      cout<<&quot;several ways to go about getting better at your Iron shots.  The best way would &quot;;
      cout<<&quot;to get a couple of lessons from an instructor,&quot;;
      cout<<&quot; and then to practice that everyday at your local driving&quot;;
      cout<<&quot; range.  That can get very expensive, so another way to &quot;;
      cout<<&quot;get better would to get an instructional video of Iron shot techniques.&quot;;
   	else
   	cout<<&quot;You entered an invalid letter, please restart the program.&quot;;
      }




while ((drill!='y')||(drill!='Y')){
	cout<<&quot;Thanks for using my program, have a nice day.&quot;;
   }



getche();
return (0);
}
[code]
 
Ok the forum format messed up the code format, but the error is occuring at the while{((drill='Y')||(drill='y')) line, thanks.
 
use == not = for checking equality
The Single = is used for setting not checking

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top