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
write a 2d array c program that can capture marks of 15 students and display the maximum mark, the sum and average​
bekas [8.4K]

Answer:

#include <stdio.h>  

int MaxMark(int* arr, int size) {

   int maxMark = 0;

   if (size > 0) {

       maxMark = arr[0];

   }

   for (int i = 0; i < size; i++) {

       if (arr[i] > maxMark) {

           maxMark = arr[i];

       }

   }

   return maxMark;

}

int SumMarks(int* arr, int size) {

   int sum = 0;

   for (int i = 0; i < size; i++) {

       sum += arr[i];

   }

   return sum;

}

float AvgMark(int* arr, int size) {

   int sum = SumMarks(arr, size);

   return (float)sum / size;

}

int main()

{

   int student0[] = { 7, 5, 6, 9 };

   int student1[] = { 3, 7, 7 };

   int student2[] = { 2, 8, 6, 1, 6 };

   int* marks[] = { student0, student1, student2 };

   int nrMarks[] = { 4, 3, 5 };

   int nrStudents = sizeof(marks) / sizeof(marks[0]);

   for (int student = 0; student < nrStudents; student++) {              

       printf("Student %d: max=%d, sum=%d, avg=%.1f\n",  

           student,

           MaxMark(marks[student], nrMarks[student]),

           SumMarks(marks[student], nrMarks[student]),

           AvgMark(marks[student], nrMarks[student]));

   }

   return 0;

}

Explanation:

Here is an example using a jagged array. Extend it to 15 students yourself. One weak spot is counting the number of marks, you have to keep it in sync with the array size. This is always a problem in C and would better be solved with a more dynamic data structure.

If you need the marks to be float, you can change the types.

3 0
2 years ago
PLEASE HELP, THANK YOU SO MUCH!
ozzi

Answer:

The correct answer is "Once a day".

Explanation:

According to social media marketing, it is a good idea to check your reader at least once a day. Readers help business by tracking what the consumers are seeing and what times of the day. Checking the reader at least once a day help people in marketing to be updated, because people's preference keep changing all the time.

3 0
3 years ago
What is the answer to this question I am not sure?
aleksley [76]

Answer:

Light sensor

Explanation:

“Street Light that Glows on Detecting Vehicle Movement. Generally, street light controlling system is a simple concept which uses a transistor to turn ON in the night time and turn OFF during the day time. The entire process can be done by a using a sensor namely LDR (light dependent resistor).”

8 0
3 years ago
Read 2 more answers
To create a public key signature, you would use the ______ key.
olya-2409 [2.1K]

Answer:

To create a public key signature, you would use the <u>_private_</u> key.

Explanation:

To create a public key signature, a  private key is essential to enable authorization.

A private key uses one key to make data unreadable by intruders and for the data to be accessed the same key would be needed to do so.

The login details and some important credentials to access user data contains both the user's public key data and private key data. Both private key and public key are two keys that work together to accomplish security goals.

The public key uses different keys to make data readable and unreadable.

The public key is important to verify authorization to access encrypted data by making sure the access authorization came from someone who has the private key. In other words, it's a system put in place to cross-check the holder of the private key by providing the public key of the encrypted data that needed to be accessed. Though, it depends on the key used to encrypt the data as data encrypted with a public key would require a private key for the data to be readable.

4 0
3 years ago
Look at the following description of a problem domain:The bank offers the following types of accounts to its customers: saving a
Alchen [17]

Answer:

The answers are explained below

Explanation:

1) Identify the potential classes in this problem domain be list all the nouns

class Customer

class Acco  unt

2) Refine the list to include only the necessary class names for this problem

the class customer is not necessary to solve the problem itself, therefore the only class could be the account class

3) Identify the responsibilities of the class or classes.

The responsibilities of the class account will be

* determination of the type of account--> Acc  ount . type(char)

*  deposit money into the account --> Acc  ount . de posit(float)

* withdraw money into the account --> Acc  ount . with draw(float)

* show balance of the account --> Acc  ount . bal ance()

* generate interest --> Acc  ount . int erest()

Please join the words together. I used spaces due to regulations

5 0
3 years ago
Other questions:
  • Which one of the following is an example of hacktivism according to you and why?
    11·1 answer
  • HURRY UP !!!!!!’<br> Each packet is addressed to the recipient's .
    8·1 answer
  • A ____ is a text document written in HTML.
    13·1 answer
  • What are the modes of operation of WLANs?
    5·1 answer
  • Write a pseudocode thats accept and then find out whether the number is divisible by 5 ​
    6·1 answer
  • Which of the following is not a skill set required by data scientists? A. Programming expertise B. Big data expertise C. Telecom
    11·1 answer
  • During the _____ of the systems development life cycle (SDLC), an information system is operating, enhancements and modification
    9·1 answer
  • Briefly explain what are JavaScript librairies​
    12·1 answer
  • Name a piece of software you often use where it is easy to produce an error. Explain ways you could improve the interface to bet
    5·1 answer
  • What is the scope of numC?
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!