|
From: ropbert d b. <lon...@ju...> - 2000-12-21 15:01:58
|
Here is one way to do what you want. .lon...@ju...
On Thu, 21 Dec 2000 15:21:41 +0100 "Scone Scone" <sc...@ho...>
writes:
> 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>
>#include <stdlib.h> // add this
> 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
systen("pause");
> }
> x++;
> }
> cin >> x;
> return 0;
> }
>
>
> Thanks!
>
_________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at
> http://www.hotmail.com.
>
>
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> http://lists.sourceforge.net/mailman/listinfo/dev-cpp-users
|