// function example
#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;
instead of asking you to type the number you think it is until you get it, on keypress it ends...any idea?Code:int main () { int me; int comp; int explode; srand((unsigned)time(0));//uses ctime to pick a semi random number comp = (rand()%11)+1; me = 5; do{ me = me - 1; cout << me <<" Tries left; " << "Try and guess which number!: "; cin >> explode; if(explode=comp){ break; } }while (me > 0); system( "pause" ); return 0; }





Reply With Quote