Okay, i am trying to figure out how to use the Continue, and Break flow controlls correctly, however i keep getting an error:
continue statement not within a loop or a switch
break statement not within a loop or a switch
My code:
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
using namespace std;
int main(int nNumberofArgs, char* pszArgs[])
{
srand ( (unsigned)time ( 0 ) );
cout << "This program generates a random number\n"
<< "Press Y to continue.";
int loopcount = 20;
char yes;
cin >> yes;
if (yes == 'Y' || yes == 'y')
{
int numb = rand() % 10 ;
cout << "Your number is:\n";
cout << numb
<< endl;
}
while(loopcount--);
{
if(loopcount < 0);
{
continue;
}
if(loopcount == 0);
{
break;
}
}
system("PAUSE");
return 0;
}