WSQ06

.kenrules here is my code for wsq06

<iostream>

<cstdlib>

<ctime>

using namespace std;

 

int main (){

  int c =0;

  int b;

  int d;

  time_t t;

  srand(time(NULL));

  t = rand() % 100 + 1;

  cout<<“I just picked a random number. “;

 

  do{

    cout << “Give me your guess”;

    cin>> b;

    c=c+1;

    if (t < b){

     cout<<“the number is too high “<<endl;

    } else {

      if (t > b){

        cout<<” the number is too low “<<endl;

      }

    }

  } while (t != b);

  cout << “great, that is the number, it took you ” <<c<< ” guesses to get the number”;

  return 0;

}

CC BY 4.0 WSQ06 by carlos green is licensed under a Creative Commons Attribution 4.0 International License.

Comments are closed.