what help do you need? the program works fine. some syntatical mistakes are 
there. once your remove then everythinh is fine


Bhalchandra Gholkar
 

 

--- On Sun, 2/22/09, Reepak <[email protected]> wrote:

From: Reepak <[email protected]>
Subject: [c-prog] Please help in this program
To: [email protected]
Date: Sunday, February 22, 2009, 3:43 AM






the following is number guessing game the randomize function is 
always choosing 41 as the guessing number. Please help

#include<iostream. h>
#include<time. h>
#include<stdlib. h>
#include<conio. h>

int main(void)
{
int score,leftchances, number,guessnumb er; 
leftchances= 6;
score=0;
randomize();
number=int (rand()%100) ;
char input; 
clrscr();
start: 
cout<<"\n Welcome To Number Guessing Game";
cout<<"\n Computer Will Select Number In Between 0 To 100";
cout<<"\n You Will Be Given Six Chances To Guess That Number\n";

do
{
cout<<"\n"<< leftchances< <":Guses Remaining\n" ;
cin>>guessnumber;
if(guessnumber> 100||guessnumber <0)
{
cout<<"\n Your Guess Should Be In Between 0 To 
100 Numbers Only";
leftchances- -;
}
if(guessnumber> number)
{
cout<<"\n Your Guess Is HIGH";
leftchances- -;
}

if(guessnumber< number)
{
cout<<"\n Your Guess Is LOW";
leftchances- -;
}

if(guessnumber= =number)
{
cout<<"\n CONGRATULATIONS YOUR GUESS IS 
CORRECT"; 
cout<<"\n the number was"<<number;
score=leftchances* 10;
cout<<"\n Your Score Is "<<score;
break;}}

while((guessnumber! =number)& &(leftchances! =0)
if (leftchances= =0)
{
cout<<"\n Sorry You Could Not Guess";
cout<<"\n The Number Was"<<number;
score=leftchances* 10;
cout<<"\n Your Score Is"<<score;
cout<<"\n Remaining Guesses"<<leftchanc es;}
cout<<"Want To Play Again Press Y";
cin>>input;
if(input==Y| |input==y)
{goto start;}
system ("pause"); }


















      

[Non-text portions of this message have been removed]

Reply via email to