Write an expression that continues to bid until the user enters 'n'. Sample output with inputs: 'y' 'y' 'n' I'll bid $7! Continue bidding? I'll bid $15! Continue bidding? I'll bid $23! Continue bidding?

Respuesta :

Answer:

#include <iostream>

#include <cstdlib>  

using namespace std;

int main() {

  char Keep_Going = '-';

  int nextBid = 0;

  srand(5);

  while (Keep_Going != 'n') { //<-- solution

     nextBid = nextBid + (rand()%10 + 1);

     cout << "I'll bid $" << nextBid << "!" << endl;

     cout << "Continue bidding? ";

     cin >> Keep_Going;

  }

  cout << endl;

  return 0;

}

Sample pseudocode that would execute this given scenario is:

Initialize variable x= 1

Increment variable x ++

If

User enters bid

Print "I'll bid $#" x++

Loop

If

User enters "n"

Print "End of bid"

What is a Pseudocode?

This refers to the simple way that an expression can be written that is easily understandable by a user.

Hence, the sample expression that can be used to loop a function or code until the user makes an input is given above and increments by 8 until the conditional statement is satisfied is given above.

Read more about pseudocodes here:

https://brainly.com/question/24735155

#SPJ9

ACCESS MORE