Sorry for this silly Q. After thinking for a while, I figured out that I'll need to write a function that takes an argument: 1000, 1000000, etc...

Code:

**// Exercise 8: a Game of Chess reward - version 2**
#include "std_lib_facilities.h"
int find_squares(int);
int main()
{
int num_of_grains = 0;
cout <<"Pls enter the number of grains: ";
cin >> num_of_grains;
if (num_of_grains <= 0)
cout <<":=), you don't need any grains - you even want to donate grains! :-)";
else
find_squares(num_of_grains);
}
int find_squares(int num_of_grains) // a function to find the number of squares
// needed to get a specified number of grains of rice
{
int grain, sum_of_grains, square;
const int N = 64; // total number of squares on a chessboard
sum_of_grains = grain = 1;
square = 2;
while (square <= N) {
grain *= 2;
sum_of_grains += grain;
if (sum_of_grains >= num_of_grains) {
cout << square << " are needed for " << num_of_grains <<" of grains of rice\n";
break;
}
++square;
}
}