You are on page 1of 2

Laboratory

Introduction to Review of C/C++


Machine Problems on Games Simulation
1. Write a program in C/C++ that plays the game of rock, paper, scissors. In this game,
each of the two players simultaneously say either rock, paper, and scissors. The
winner is the one whose choice beats than that of the other.
The rules are: Paper beats rock, Rock beats scissors, and Scissor beats paper
For example:

Choose either rock, scissor, or paper (R,S, P): S


I chose rock.

2. Make a C program that will simulate the Tic-Tac-Toe game. In this game, the
matrix is 3x3 format and you will input the row and column coordinates.
There will be two players; the user and the other player is the computer.

Sample Output:

Player 1

Player 1

Input the row value: 2

Input the row value: 2

Input the column value: 2

Input the column value: 1

Display Output:
1

Display Output:
2

1
2
3

Player 2

1
X

Player 2
Input the row value: 2
Input the column value: 1
Display Output:
1

1
2

3. Make a C program that will display the Weight Conversion Table of pounds
and kilos.
Kilo per pound =0.45359
Pounds will range from 10 to 250 increment by 10
Screen Output:
Pounds
Kilos
10
4.5359
20
9.0718
30
13.6077
40
18.1436
50
22.6795
60
27.2154
70
31.7513
80
36.2872
90
40.8231
100
45.3590
110
49.8949
120
54.4308
130
58.9667
140
63.5026
150
68.0385
160
72.5744
170
77.1103
180
81.6462
190
86.1821
200
90.7180
210
95.2539
220
99.7898
230
104.3257
240
108.8616
250
113.3975
4. Create a C function for each arithmetic operation of rational numbers:
a) Add two rational numbers.
b) Subtract two rational numbers.
c) Multiply two rational numbers.
d) Divide two rational numbers.

You might also like