Ok, im not that much of a geeky smart guy in C++,
but i've got some skillz..
so im trying to make a very simple game that will randomize
1 number for the computer and 1 number for the person using the program and whomever(person or computer) gets the highest number(lets say 1-10) wins, and keeps score also...
If anyone can just post here, or help me make this program in anyway that would be awsome!!!

## All 10 Replies

As for keeping score, you could have two variables.

``````int games_won_by_computer;
int games_won_by_player;``````

Once you're done that game, you could try a guessing game where the user guesses a random number in as few tries as possible.

Ok, im not that much of a geeky smart guy in C++,
but i've got some skillz..
so im trying to make a very simple game that will randomize
1 number for the computer and 1 number for the person using the program and whomever(person or computer) gets the highest number(lets say 1-10) wins, and keeps score also...
If anyone can just post here, or help me make this program in anyway that would be awsome!!!

its very simple
wat exactly u want ?
source code ??

i want to know how in c++

// 07/08/10 04:52

``````/*
Guess the computers Number game
*/

//main
#include <iostream>
#include <string>
#include <conio.h>

using namespace std;

int main()
{
double firmver = 0.01;; // Game version

cout << "\t\t\tGuess Num " << firmver;
cout << "\nCompete with the computer.\nTry to guess the right number!\nSee how thinks faster!\n\n";
cout << "Do you want to play?(yes/no || y/n)" << endl;

string playgame; // to check if player wants to play
cin >> playgame;
cin.get();

// Does player want to play?
if(playgame == "yes" || playgame == "YES"
|| playgame == "Yes" || playgame == "y"
|| playgame == "Y")
{
cout << "Press any key to start" << endl;

//Game loop
while(playgame == "yes" || playgame == "YES"
|| playgame == "Yes" || playgame == "y"
|| playgame == "Y")
{
int psnum; //player secret num
int csnum; //computer secret num

long pgnum; //player guess num
int cgnum; // computer guess num

int amountpg = 1; // amount player guesses max 3 times per guess
int amountcg = 0; // amount computer guesses max 3 times per guess

psnum = rand() % 50 + 1; // Initiliaze  player secret num from 1-50;
csnum = rand() % 50 + 1; // Initiliaze  computer secret num from 1-50;
cout << amountpg << endl;

while(amountpg != 3)
{

cin >> pgnum;

if(pgnum == psnum)
{
cout << "You guessed right" << endl;
amountpg = 0;
}

if (pgnum > psnum)
{
cout << "It is too high" << endl;
amountpg++;
cout << amountpg << endl;
}

if (pgnum < psnum)
{
cout << "It is too low" << endl;
amountpg;
cout << amountpg << endl;
}
}

cout << "You guessed 3 times wrong! Concentrate on solving the next guess" << endl;
psnum = rand() % 50 + 1; // Initiliaze  player secret num from 1-50;
amountpg == 0;

}
}
}``````

how run above program

You need a compiler. There mare many free compilers just a google away.

Did half a programming class just register to post in this thread?

``````#include<iostream>
#include<string>

using namespace std;

int main()
{
string s;