1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
ycow [4]
3 years ago
9

Define a function PrintFeetInchShort, with int parameters numFeet and numInches, that prints using ' and " shorthand.

Computers and Technology
1 answer:
Kisachek [45]3 years ago
5 0

Answer:

I am writing a function using C++ programming language. Let me know if you want the program in some other programming language.

void PrintFeetInchShort(int numFeet , int numInches){

   cout<<numFeet<<"\' "<<numInches<<"\"";

The above function takes two integer variables numFeet and numInches as its parameters. The cout statement is used to print the value of numFeet with a single quote at the end of that value and  print the value of numInches with double quotes at the end of that value. Here \ backslash is used to use the double quotes. Backslash is used in order to include special characters in a string. Here i have used backslash with the single quote as well. However it is not mandatory to use backslash with single quote, you can simply use cout<<numFeet<<"' " to print a single quote. But to add double quotes with a string, backslash is compulsory.

Explanation:

This is the complete program to check the working of the above function.

#include <iostream>  // to use input output functions

using namespace std;   //to identify objects like cout and cin

void PrintFeetInchShort(int numFeet , int numInches){

//function to print ' and ' short hand

   cout<<numFeet<<"\' "<<numInches<<"\"";  }

int main() { //start of the main() function body

  PrintFeetInchShort(5, 8);    }

//calls PrintFeetInchShort() and passes values to the function i.e. 5 for //numFeet  and 8 for numInches

If you want to take the values of numFeet and numInches from user then:

int main() {

   int feet,inches;  // declares two variables of integer type

   cout<<"Enter the value for feet:"; //prompts user to enter feet

   cin>>feet;  //reads the value of feet from user

   cout<<"Enter the value for inch:";   //prompts user to enter inches

   cin>>inches;      //reads the value of inches from user

  PrintFeetInchShort(feet, inches);   } //calls PrintFeetInchShort()

The screenshot of the program and its output is attached.

You might be interested in
Which statement is true regarding bitmap images?
horrorfan [7]
<span>Which statement is true regarding bitmap images?</span>
I believe it is D

8 0
2 years ago
Read 2 more answers
Which type of computer network ensures high security
Gwar [14]

Answer:

I elieve the answer for this is Juniper Network Firewall

Hope this helps

3 0
2 years ago
Html code to hyperlink file​
Dovator [93]

Answer:

<p>Want to contact a specific staff member?

Find details on our <a href="contacts.html">contacts page</a>.</p>

Explanation:

7 0
2 years ago
Write statements that output variable numComputers as follows. End with a newline
gavmur [86]

Complete Question:

Write statements that output variable numComputers as follows. End with a newline. There are 10 computers.

#include <iostream>

using namespace std;

int main()

{

int numComputers;

cin >> numComputers; // Program will be tested with values: 10.

...

return 0;

}

Answer:

cout << "There are ";

cout << numComputers;

cout << " computers." << "\n";

Explanation:

Using three cout statements the string "There are 10 computers." is printed out, notice that the variable numComputers is entered by the user when the program is run. Another way of concatenating an integer variable and string for printout is by the use of the + (plus) operator.

8 0
2 years ago
20 points
riadik2000 [5.3K]
By the year 2030, artificial intelligence (A.I.) will have changed the way we travel to work and to parties, how we take care of our health and how our kids are educated.
3 0
3 years ago
Read 2 more answers
Other questions:
  • Both the USB flash drive and the DVD are data storage devices, but they both have numerous differences. Both can contain insane
    6·1 answer
  • What internal hardware device does a computer use to connect to a wired or a wireless network?
    10·1 answer
  • 15
    5·2 answers
  • Select the correct answer.
    5·1 answer
  • Are the buying and selling of stocks centralized activities? Why or why not?
    10·2 answers
  • 1. Which of the following is not related to a buffer overflow? A. Static buffer overflow B. Index error C. Canonicalization erro
    10·1 answer
  • Number Array Class
    5·1 answer
  • Assume that strikeCounter has already been declared to be a "pointer to int". Assume further that strikeCounter has been initial
    7·1 answer
  • Write a Boolean expression that tests if the value stored in the variable num1 is equal to the value stored in the variable num2
    10·1 answer
  • Briefly explain the emerging trends in micro computer technology in relation to size
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!