Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C++

Name: Anonymous 2009-06-12 6:31

Hello /prog/.

I know very little about C++. and my only other experience with programming is a calculator in freeBasic.

I studied how to programm a guessing game from the internets but my 4.9.9.2 Dev C++ fail to compile it.

this is what i wrote:

#include <iostream>
#include <ctime>
#include <conio.h>
using namespace std;

int main(void){
   
    int UPPER_LIMIT;
    int random;
    int userguess;
    char playAgain;
    srand(static_cast<unsigned int>(time(0)));
    random = rand()%20+1;
   
    do{
                           
    while(userguess !== random){
   
    cout << "Please enter a number between 1 - 20: ";
    cin >> userguess
   
    if(userguess == random){
                 cout << "wow good job you guessed right." <<endl;
                 }
                
    else if(userguess > random){
    cout << "that number is too low" <<endl;
    system("CLS");
}
        
    else if(userguess < random){
         cout << "that number is too high" <<endl;
    system("CLS");
   
    }
}

cout << "Do you wish to play again? y//n: ";
cin >> playAgain;


} while(tolower(playAgain == 'y');


getch();
return 0;
}

PLEEAASE HAAALP /PROG/.
Thanks in advance.

Name: Anonymous 2009-06-12 12:36

>>40
back to /b/ with you

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List