32.8k views
3 votes
Define a method printFeetInchShort, with int parameters numFeet and numInches, that prints using ' and " shorthand. End with a newline. Ex: printFeetInchShort(5, 8) prints: 5' 8"

User CherryDT
by
7.5k points

1 Answer

1 vote

Answer:

Follows are the progrm to this question:

#include <iostream>//defining header file

using namespace std;

void printFeetInchShort (int numFeet , int numInches)//defining a method printFeetInchShort

{

cout<<numFeet <<"'"<<numInches<< " \" ";//print value with ' and "

}

int main()//defining main method

{

printFeetInchShort(5,8);//call method by pssaing integer value

return 0;

}

Output:

5'8 "

Step-by-step explanation:

In the above-given program, a method "printFeetInchShort" is defined, that accepts two integer variable, that is "numFeet and numInches" in its parameters.

  • Inside the method, a print method is used that prints integer variable value with " ' and " " value.
  • At the last step, the main method is defined, which calls the above-given method by passing integer value in its parameters.

User Clifford Fajardo
by
7.2k points