FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
c-plus-plus/guess.cpp at main · shruthi-jay/c-plus-plus · GitHub
shruthi-jay
/
c-plus-plus
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
c-plus-plus
/
guess.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
60 lines (52 loc) · 1.21 KB
Breadcrumbs
c-plus-plus
/
guess.cpp
Copy path
File metadata and controls
60 lines (52 loc) · 1.21 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
#
include
<
iostream
>
#
include
<
cstdlib
>
#
include
<
ctime
>
using
namespace
std
;
int
play
()
{
int
user,a=
1
;
int
random=
rand
() %
10
;
random+=
1
;
cout<<
"
its the guessing game. guess a random number from 1 to 10
\n
enter your choice.lets test your luck
\n
"
;
do
{
cout<<
"
enter your choice
"
;
//
cout<<random<<"\n";
cin>>user;
if
(user == random)
{
cout<<
"
Arent you a lucky one....😍😍😍🤩!oh u win
\n\n
"
;
a=
0
;
}
else
if
(user<random)
{
cout<<
"
oops too small
\n
"
;
cout<<
"
click 1 to just try again or just enter 0 if u dont feel like playing.
\n
"
;
cin>>a;
}
else
{
std::cout<<
"
oh too big
\n
"
;
cout<<
"
click 1 to try again or just enter 0 if u dont feel like playing.
\n
"
;
cin>>a;
}
}
while
(a!=
0
);
}
int
main
() {
srand
(
time
(
NULL
));
int
choice;
do
{
cout<<
"
enter 0 to quit 1 to play
\n
"
;
cin>>choice;
switch
(choice)
{
case
0
: cout<<
"
you exited.Come back next time!😊
"
;
choice=
0
;
break
;
case
1
:
play
();
break
;
default
:cout<<
"
wrong choice
"
;
}
}
while
(choice!=
0
);
}
Back
|
FazBrowse Home
|
New Git URL