Zangeel
04-13-2010, 04:08 PM
I'm trying to get back to learning C++. I have a basic code here, and it works but the console application keeps exiting after the loop, how can I prevent the application from exiting?
#include <iostream>
void main()
{
int iNumber;
int iCounter = 0;
std::cout << "How many times to loop?" << std::endl;
std::cin >> iNumber;
if ((iNumber) && (iNumber < 10000))
{
do
{
std::cout << "Looped content" << std::endl;
iCounter = iCounter + 1;
} while (iCounter < iNumber);
}
}
#include <iostream>
void main()
{
int iNumber;
int iCounter = 0;
std::cout << "How many times to loop?" << std::endl;
std::cin >> iNumber;
if ((iNumber) && (iNumber < 10000))
{
do
{
std::cout << "Looped content" << std::endl;
iCounter = iCounter + 1;
} while (iCounter < iNumber);
}
}