and yes, i had an infinite loop.
i did what you said by putting the curly brace after the while loop.
now i have an error at the while().
this is what I have-
#include <iostream>
using namespace std;
void main()
{
int i;
i = 1
while(i <= 10) //i have an error at this line
{
cout << i * i << endl;
i++;
}