Back | Reverse |

How to write this program?
Link | by nivek on 2007-09-11 00:55:38
My school just gave me an assignment in writing a program using C compiler but I have no idea how to do it...
It goes like this :
Write a number guessing game program which generates the number randomly. When you finish the program, it should look like this:

Number of players:2 <--(lets say there are 2 players)
Player's Name:__
__

Scores:
(player 1's name): <--(points are added for every winning game)
(player 2's name):

(Assuming random generated number is 555)
Number starts at:100
Number ends at :1000

What is the number?
(player 1's name):896
Wrong. It is <896
(player 2’s name):400
Wrong. It is >400
(player 1’s name):555


Bingo! The answer is 555. (player 1’s name) wins this game.

Continue(Press C) or Exit(Press E)?


Can anyone help me please?

Re: How to write this program?
Link | by gendou on 2007-09-11 01:02:22
why don't you start by reading the textbook?


Re: How to write this program?
Link | by on 2007-09-11 05:07:57
i agree with gendou-sama. Read the text first, then if u really do not know, consult your teacher. I myself am not too familiar with this particular programming.


Re: How to write this program?
Link | by ruyvlopez on 2007-09-11 06:21:53 (edited 2007-09-11 06:32:02)
I can only give you true hints but I never give the true answer to that question.

1. Go read about Conditional Statement (example: if, elseif, iif) in C++ or C Compiler format and try to understand it.

2. You must know the code in C Compiler on how to input the number or data to be distiguish/stored by the program and make it deal with the conditional statement.

3. Try to simulate it MANUALLY. Use the codes that you understand or know in C Compiler and try to pseudo code it.


That's the hints for you to understand. Try to exert effort about your studies. If you want the "TRUE CODE" for your assignment in easy-go-lucky-asking form, well, you better quit that subject.

Friendly Advice: If a PERSON knows the CODE but can't understand what the CODE does, the PERSON doesn't learn anything about the exact use of the CODE. If you memorize the CODE without understanding it, it will be useless.

Back | Reverse |

Copyright 2000-2025 Gendou | Terms of Use | Page loaded in 0.0009 seconds at 2025-05-29 11:31:50