Here is my code, you have to guess a number that is randomly selected by the program. I did it with no help (except for the time\/rand thing).<\/p>\n
Hope this helps you!<\/p>\n
#WSQ06<\/a> #Tc1017<\/a><\/p>\n \u00a0<\/p>\n #include<\/a> <\/p>\n #include<\/a> <\/p>\n #include<\/a> <\/p>\n using namespace std;<\/p>\n \u00a0<\/p>\n int main() {<\/p>\n \u00a0 srand(time(0)); \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \/\/time changes, the number changes<\/p>\n \u00a0 int r=1+(rand() % 100);<\/p>\n \u00a0 int x;<\/p>\n \u00a0 int count = 0;<\/p>\n \u00a0 cout\n<\/p>\n \u00a0<\/p>\n cout\n<\/p>\n cin >>x;<\/p>\n count = count+1;<\/p>\n \u00a0<\/p>\n while (x!=r){<\/p>\n \u00a0 if(x<\/p>\n \u00a0 cout\n<\/p>\n \u00a0 cin >>x;<\/p>\n \u00a0 count = count + 1;<\/p>\n } else {<\/p>\n \u00a0 if (x>r){<\/p>\n \u00a0 \u00a0 \u00a0 cout\n<\/p>\n \u00a0 \u00a0 \u00a0 cin >>x;<\/p>\n \u00a0 \u00a0 \u00a0 count = count + 1;<\/p>\n \u00a0}<\/p>\n \u00a0 }<\/p>\n }<\/p>\n \u00a0<\/p>\n cout\n<\/p>\n \u00a0 return 0;<\/p>\n \u00a0<\/p>\n }<\/p>\n <\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":" Here is my code, you have to guess a number that is randomly selected by the program. I did it with no help (except for the time\/rand thing).<\/p>\n Hope this helps you!<\/p>\n #WSQ06<\/a> #Tc1017<\/a><\/p>\n <\/p>\n