you may want to have something like:
Code:
int main()
{
int grade = 1;
while( grade != 10 )
{
cout << " hello world " << endl;
grade++;
}
system("pause");
return 0;
}
or using simply a for loop:
Code:
int main()
{
for( int grade = 1;grade != 10; grade++)
{
cout << " hello world " << endl;
}
system("pause");
return 0;
}
But the most important thing is to always see if you are incrementing or decrememnting the variable that you are using as the test condition of your loops!
In your case you have not included a statement where grade should change or increment inside your while loop. That is why you are getting an infinite loop!
Regards,
wakish