help with this program please.....?
You are required to create a game that will operate as follow
• The player will guess a number between 1 and 9
• The computer will then select a random number between 1 and 9
• The program will then compare the two numbers and if they are equal the player wins and his/her score is increased by 1. if they are not equal the computer score is increased by 1.
• The player can exit the game by entering -1. when this occurs the players score and the computer score is displayed on the screen and the overall winner is congratulated via an appropriate message on the screen.
You are required to modify the above game so that instead of guessing numbers the player will guess a three letter word. You are required to ensure that the word enter has only three characters, otherwise allow the user to try again. You are required to create an array of string of size 10 of with three letter words will displayed to the user at the beginning of the game from which the player will select a word.
The word selected by the player and the one selected by the computer will be compared and the scoring is done similar to the one above. In case however, allow the user enter the number of times they desire to run the program.at the end of the game display the computer’s score and the player’s score and congratulation message to the overall winner.
its a c program
IT IS A C PROGRAM AND GUYS I ONLY HAVE THIS JUST HELP ME PLEASE WITH YOUR KINDNESS PLEASE....
int num, user=o, com=0, guess;
printf("to see score enter '-1'\n\n");
printf("enter any number from 1-9:");
jiji thnx with part A...ur so kind.......but if u could help with part b it would be even more lovely.....
- Anonymous1 decade agoFavorite Answer
this is easy but what language are you asked to write it in ? C? Python? PASCAL?
I can write you the codein C but that's not the right way, at least try it!
Anyway here is the answer for the first, the second is basically the same but more complicated because you will be working with strings
int main ( int argc, char** argv )
int mysteryNumber = 0, numberEnterd = 0, userScore=0, compScore=0;
const int MAX = 9, MIN = 1;
printf("Guess a number between 1 and 9? ");
// Generate the Mystery Number
mysteryNumber = (rand() % (MAX - MIN + 1)) + MIN;
if (mysteryNumber == numberEnterd)
printf("yes that's it, your score now is %d and the computer's score is %d\n", userScore, compScore);
else if (mysteryNumber != numberEnterd)
printf("no that's not it, your score now is %d and the computer's score is %d\n", userScore, compScore);
} while (numberEnterd != 0);
printf("the user score is %d and the computer score is %d\n", userScore, compScore);
printf("Congrats Mr. User you win\n");
printf("Congrats Mr. Computer you win\n");
printf("Congrats for both of you!\n");
I didn't test it so they might be some errors. And I took 0 instead of -1
- hindelangLv 44 years ago
software has grow to be the traditional for computing. Programme is the unique British spelling - the two would be utilized by applying human beings - different than that bill Gates' spellchecker will stop you.
- eli porterLv 51 decade ago
no one is doing your homework. you can post this question for the third time when you have some code at least.
- 1 decade ago
It would really depend on what programming language you are using.