| View previous topic :: View next topic |
| Author |
Message |
maxuer Newbie cheater
Reputation: 0
Joined: 07 Dec 2007 Posts: 20
|
Posted: Wed Jan 16, 2008 7:53 pm Post subject: Simple |
|
|
| Nobody can show a code to create a basic game, like that you need say the correct number... Use language C++ PLZ
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Wed Jan 16, 2008 10:56 pm Post subject: |
|
|
| Code: | #include <iostream>
#include <cstdlib>
#include <time.h>
int g;
int r;
int main(void)
{
srand(time(0));
r = rand() % 11; //0-10
do{
std::cout << "Guess a number, 0-10.\n";
std::cin >> g;
if (r < g){
std::cout << "Lower!\n";
}
else if (r > g){
std::cout << "Higher!\n";
}
}while (g != r);
std::cout << "That's it!";
return 0;
} |
edit: argh.
Last edited by hcavolsdsadgadsg on Thu Jan 17, 2008 3:39 am; edited 1 time in total |
|
| Back to top |
|
 |
Noz3001 I'm a spammer
Reputation: 26
Joined: 29 May 2006 Posts: 6220 Location: /dev/null
|
Posted: Thu Jan 17, 2008 2:36 am Post subject: |
|
|
| ^ Tut tut, return?
|
|
| Back to top |
|
 |
appalsap Moderator
Reputation: 0
Joined: 27 Apr 2006 Posts: 6753 Location: Pakistan
|
Posted: Thu Jan 17, 2008 2:52 am Post subject: |
|
|
| noz3001 wrote: | | ^ Tut tut, return? |
Most compilers will compile that as is.
It's one of the great mysteries of the world.
_________________
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Thu Jan 17, 2008 3:36 am Post subject: |
|
|
oh shit how did that one slip by me
I FEEL LIKE I'VE LET EVERYONE DOWN, UGH
|
|
| Back to top |
|
 |
|