Answer to Question #219201 in C++ for Kojo

Question #219201

Print a message telling a user to press the letterToQuit key numPresses times to quit. End with newline.

•Ex: If letterToQuit = 'q' and numPresses = 2, print:

Press the q key 2 times to quit.

#include <iostream>

using namespace std;

int main() {

  char letterToQuit;

  int numPresses;

  cin >> letterToQuit;

  cin >> numPresses;

  /* Your solution goes here */

  return 0;

}

1
Expert's answer
2021-07-20T17:01:21-0400
#include<iostream>
using namespace std;
int main(){
	char letterToQuit;


  int numPresses;
cout<<"Enter a letter to quit";
  cin >> letterToQuit;
cout<<"Enter the number of times to enter letter "<<letterToQuit<<endl;
  cin >> numPresses;
   
cout<<"Press the "<<letterToQuit<<" key "<<numPresses<<" times to quit";
  return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS