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).

Hope this helps you!

#WSQ06 #Tc1017

 

#include

#include

#include

using namespace std;

 

int main() {

  srand(time(0));           //time changes, the number changes

  int r=1+(rand() % 100);

  int x;

  int count = 0;

  cout

 

cout

cin >>x;

count = count+1;

 

while (x!=r){

  if(x

  cout

  cin >>x;

  count = count + 1;

} else {

  if (x>r){

      cout

      cin >>x;

      count = count + 1;

 }

  }

}

 

cout

  return 0;

 

}

CC BY 4.0 WSQ06!! by Ruth Vanessa Baeza Elizalde is licensed under a Creative Commons Attribution 4.0 International License.