CHALLENGE ACTIVITY 2.14.1: Printing a message with ints and chars. 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:

Respuesta :

Answer:

Following are the program in c++ language

#include<iostream> // header file

using namespace std; // namespace

int main() // main method

{  

char l;   // variable declaration  

int number_presss; // variable declaration  

cout<<"Enter the character letter To Quit the key and num to Press: ";

cin>>l; // Read the character value

cin>>number_presss;// Read the integer value  

cout<<"Press the key  "<<l<<" key 4  "<<number_presss<<" times to quit"; //display the number with the format

}

Output:

Enter the character letter To Quit the key and num to Press: w

4

Press the key  w  key 4 times to quit

Explanation:

Following are the Explanation of the program  

  • Read the integer value in the "number_presss" variable by the user using cin function.
  • Read the character value in the "l" variable by the user using cin function.
  • Finally display their value in their respective format
ACCESS MORE
EDU ACCESS