|
From: Scone S. <sc...@ho...> - 2000-12-21 14:21:47
|
Hello,
I'm a beginning C++ programmer and I have made a program that
calculates all numbers smaller than 100 that contain a 2.
It seems to work, but I would like to be able to pause the output
when I have got e.g. 20 numbers, and when I press enter the program
should continue.
So far I have this:
#include <iostream>
int fPrintX(unsigned x)
{ cout << x << endl << x*x << endl;
y++;
}
int main()
{
unsigned x, y;
y=0;
cout << "This program will search all numbers smaller than 100 that" <<
endl;
cout << "contain the number 2, and will also calculate the square." <<
endl;
x=0;
while (x<=100)
{ if (x%10==2)
{ fPrintX(x);
}
else if (x/10==2)
{ fPrintX(x);
}
if (y==20)
{ //here I would like the program to pause
}
x++;
}
cin >> x;
return 0;
}
Thanks!
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
|