-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
152 lines (144 loc) · 3.93 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
void kullanici(int kullaniciSecimi){
cout << endl;
cout << "\t\t";
cout << "\t\t Sizin seciminiz: ";
switch (kullaniciSecimi) {
case 1:
cout<<"Tas"<<endl;
break;
case 2:
cout<<"Kagit"<<endl;
break;
case 3:
cout<<"Makas"<<endl;
break;
default:
break;
}
}
void bilgisayar(int bilgisayarSecimi){
cout << endl;
cout << "\t\t";
cout << "\t\t Bilgisayarin secimi: ";
switch (bilgisayarSecimi) {
case 1:
cout<<"Tas"<<endl;
break;
case 2:
cout<<"Kagit"<<endl;
break;
case 3:
cout<<"Makas"<<endl;
break;
default:
break;
}
}
int main(){
cout << "\t\t\t\t";
for(int i = 0; i < 50; i++){
cout << "-";
}
cout << endl;
cout << "\t\t\t\t";
cout << "\t Tas-Kagit-Makas Oyununa Hos Geldiniz" << endl;
cout << "\t\t\t\t";
for(int i = 0; i < 50; i++){
cout << "-";
}
cout << endl;
cout << "\t\t\t\t";
cout << "\t\t 1 - Tas" << endl << "\t\t\t\t" << "\t\t 2 - Kagit" << endl << "\t\t\t\t" << "\t\t 3 - Makas" << endl << "\t\t\t\t" << endl;
cout << "\t\t\t\t";
for(int i = 0; i < 50; i++){
cout << "-";
}
cout << endl;
while(true){
cout << endl;
cout << "\t\t";
cout << "\t\t Seciminizi yapiniz: ";
cout << "\t\t\t\t";
int kullaniciSecimi;
cin>>kullaniciSecimi;
if (kullaniciSecimi!=1 && kullaniciSecimi!=2 && kullaniciSecimi!=3){
cout << endl;
cout << "\t\t";
cout << "\t\t Gecerli bir secim yapin!";
cout << "\t\t\t\t";
cout << endl;
continue;
}
kullanici(kullaniciSecimi);
srand(time(0));
int bilgisayarSecimi=rand()%3+1;
bilgisayar(bilgisayarSecimi);
if (kullaniciSecimi==bilgisayarSecimi){
cout << endl;
cout << "\t\t\t\t";
for(int i = 0; i < 50; i++){
cout << "-";
}
cout << endl;
cout << "\t\t";
cout << "\t\t Berabere!";
cout << endl;
cout << "\t\t\t\t";
for(int i = 0; i < 50; i++){
cout << "-";
}
cout << endl;
} else if ((kullaniciSecimi==1 && bilgisayarSecimi==3)||(kullaniciSecimi==2 && bilgisayarSecimi==1)||(kullaniciSecimi==3 && bilgisayarSecimi==2)){
cout << endl;
cout << "\t\t\t\t";
for(int i = 0; i < 50; i++){
cout << "-";
}
cout << endl;
cout << "\t\t";
cout << "\t\t KAZANDINIZ!";
cout << endl;
cout << "\t\t\t\t";
for(int i = 0; i < 50; i++){
cout << "-";
}
cout << endl;
} else{
cout << endl;
cout << "\t\t\t\t";
for(int i = 0; i < 50; i++){
cout << "-";
}
cout << endl;
cout << "\t\t";
cout << "\t\t Kaybettiniz!";
cout << endl;
cout << "\t\t\t\t";
for(int i = 0; i < 50; i++){
cout << "-";
}
cout << endl;
}
cout << endl;
cout << "\t\t";
cout << "\t\t Tekrardan oynamak ister misiniz?\n"<<endl<<"\t\t\t\t"<<" 1= Evet\t 2= Hayir\t"<<endl;
int tekrarOyna;
cin>>tekrarOyna;
if (tekrarOyna!=1){
cout << endl;
cout << "\t\t\t\t";
cout << "\t\t Oyun bitti." << endl;
cout << "\t\t\t\t";
for(int i = 0; i < 50; i++){
cout << "-";
}
cout << endl;
break;
}
}
return 0;
}