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-14 23:09

>>65
I saw it when you posted it, and I was quite impressed; I guess I didn‘t respond though. Probably because I don‘t have a 32-bit windows box to run it on, and I suspect it wouldn‘t run under wine. I can more-or-less see what it‘s doing, though.
:)
Here, have a screenshot: http://i42.tinypic.com/2csj910.jpg
The data is the number of pixels to run before each color switch, and most of the actual code deals with stuffing pixels into the right bit positions on a black-and-white bitmapped display (necessary to get that kind of resolution in 16-bit DOS).

Have a look at http://filebin.ca/xvfkdb/fjolnir.tar.gz if you‘re bored and understand Haskell. I've only implemented the parts of "GRUNNUR" that I've been interested in so far, which isn't a great deal.
This is way beyond my Haskell ability, but I‘ll definitely look it over.

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