BTC USD 65,617.5 Gold USD 4,434.50
Time now: Jun 1, 12:00 AM

Sapa reti C++ sini?

izack1981

Legendary Member
gem
Messages
10,374
Paid Membership
Joined
Feb 15, 2007
Messages
10,374
Reaction score
61
Points
120
Salam..

Sapa reti C++ buat prog macam nie?


The program first asks the number of points the user wants to start with, as shown below:



How many points would you like? 2000

It then prints the guess menu and allows up to five guesses, as shown next:



Guesses Choices

O Odd

E Even

L Low

M Med

H High

F Left

C Center

R Right

N Number



How many guesses would you like? 5



Guess 1 :

Enter your choice: L

Points at risk? 20



Guess 2 :

Enter your choice: H

Points at risk? 15



Guess 3 :

Enter your choice: N

Enter your number: 18

Points at risk? 20



Guess 4 :

Enter your choice: O

Points at risk? 120



Guess 5 :

Enter your choice: L

Points at risk? 10



After all guesses have been made, the program generates the random number and displays the following message:



My number is: 31



The program then prints the situation of the player:



Previous Points: 2000



Guess


Type


Number


Amount


Win or Lose

1


L





20


-20

2


H





15


+30

3


N


18


20


-20

4


O





120


+120

5


L





10


+20



You won 140 points in this turn.

Your new balance is: 2140 points.

Do you want to play again (Y or NO)? Y
 
c++ fail..:">:">
 
blaja dulu tp dh lupe la bro...
command dia pun aku x brp igt...
 
ikotkan ati,memangla aku nak sgt2 tolong ko sbb ak dulu blaja c++ dgn VB..tp syg...masa g klas,aku tdo...ak ponteng..asignment aku soh budak buat..bila final exam aku tiru n bawak toyol..errrr ko jgnla jadik mcm aku..ngeee baek ko wat senirik..cuba try test mane la tau jadi ke..;)
 
@TT

ni nak suruh orang buatkan ke apa ni? kenapa tak buat sendiri?

ini macam soalan assignment....
 
ikotkan ati,memangla aku nak sgt2 tolong ko sbb ak dulu blaja c++ dgn VB..tp syg...masa g klas,aku tdo...ak ponteng..asignment aku soh budak buat..bila final exam aku tiru n bawak toyol..errrr ko jgnla jadik mcm aku..ngeee baek ko wat senirik..cuba try test mane la tau jadi ke..;)

ahahaha... kita serupaaa...:eek::eek::eek::eek::eek:
 
nseb bek aku x paham...
kalu x ...
leh godek2...
best woo kalu dpt buat...
kembang punkoq 3 jam stgh....
 
Code:
#include <inpout.h>

void main()
{
int p,g;
char c;

cout<<"How many points would you like?";
cin>>p;


cout<<"Guesses Choices"<<br
<<"O Odd"<<br
<<"E Even"<<br
<<"L Low"<<br
<<"M Med"<<br
<<"H High"<<br
<<"F Left"<<br
<<"C Center"<<br
<<"R Right"<<br
<<"N Number";

cout<<"How many guesses would you like?";
cin>>g;

if(int i= 0; i =< g; i++)

cout<<"Guess "<<i<<endl;

cout<<"Enter your choice :";
cin>>c;

if (c == 'L')||(c == 'l')

.
.
.
.
.
Math part

Aku skip math part. tak brape paham ape dia nak. hehe. btw, ni boleh dijadikan idea n permulaan. aku takde software C++. aku pakai notepad jek ni. tak compile lagi. tgk la kalo ade error ke. ade byk cara nak tulis prog ni. ni cara paling simple la kot. :D
 
Back
Top
Log in Register