what's wrong with this???

I wrote a program that will allow the user to guess a character from a to z.But the program does not compiled.I m using Dev C++(Bloodshed).Tell me whats wrong with the program???


//This program allows the user to guess a character from a to z
//do-while construct is used to allow five tries for guessing
#include<iostream.h>
main()
{
//declare & initialize variables
int tryNum=0;
char c;

//do-while construct
do
{
cout<<"Please enter the character from a to z for guessing: ";
cin>>c;

//check the entered character for equality
if(c=='z')
{
cout<<"congratulations, your guess is correct.";
tryNum=6;
}
else
{
tryNum=tryNum+1;
}
}
while(tryNum<=5)
}
When you post code, put it in [code] tags. When code doesn't compile, post the error message you were given.

The header should be "iostream" (without .h)
"main()" should be "int main()" and have "return 0" at the end.

Other than that I don't see anything..
Sorry this was my first topic.I will take care of tags next time.Now to i m going to try what you told me.Thanks again
there should be a semicolon after
while(tryNum<=5)

a do loop is a statement itself.so at the end of th loop there must be a semicolon like this
do
{
________;
________;
________;
}while(xxxxx);
Last edited on
Topic archived. No new replies allowed.