Code:
#include <StdAfx.h> #pragma hdrstop #include <conio.h> #include <ctype.h> #include <iostream> //---------------------------------------------------------------------- using namespace std; using std::cout; using std::endl; using std::cin; int main ( ) { int i; int x; std::cout << "\n Please enter an even number:"; cin >> x; if(x%2==1) std::cout << "\n Number entered was not even."; //This is where i need the loop back to start else std::cout << "\n Number entered was " <<x<< "."; std::cout << "\n\n Next ten even values: "; for (i=0; i<=8; i++) { x=x+2; std::cout <<x<< " "; } x=x+2; std::cout <<x<< "."; getch(); return 0; }
Comment