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
Zielflug [23.3K]
3 years ago
15

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

newline. Ex: PrintFeetInchShort(5, 8) prints: 5' 8" Hint: Use \" to print a double quote.
Computers and Technology
1 answer:
Ira Lisetskai [31]3 years ago
6 0

Answer:

The solution code is written in C++

  1. #include <iostream>
  2. using namespace std;
  3. void PrintFeetInchShort(int numFeet, int numInches){
  4.    cout<<numFeet<<"\'"<<numInches<<"\""<<"\n";
  5. }
  6. int main()
  7. {
  8.    PrintFeetInchShort(5, 8);
  9.    
  10.    return 0;
  11. }

Explanation:

Firstly, create a function  PrintFeetInchShort that takes two integers, numFeet and numInches (Line 5). Display the numFeet followed by a single quote, '. To print the single quote, we can use the escape sequence, \'. (Line 6)

After the single quote, it is followed with numInches and then a double quote ". The double quote is printed using another escape sequence , \".

Finally print the new line, "\n"  

You might be interested in
I need this ASAP!
Elanso [62]

Answer:

b

Explanation:

4 0
3 years ago
Read 2 more answers
30.1 LAB*: Warm up: Online shopping cart (Part 1) (1) Create three files to submit: ItemToPurchase.h - Class declaration ItemToP
nlexa [21]

Answer:

see explaination

Explanation:

#ifndef ITEMTOPURCHASE_H

#define ITEMTOPURCHASE_H

#include<iostream>

using namespace std;

class ItemToPurchase

{

public:

ItemToPurchase();

void setItemName(string name);

void setItemPrice(int itemPrice);

void setItemQuantity(int itemQuantity);

string getItemName();

int getItemPrice();

int getItemQuantity();

virtual ~ItemToPurchase();

protected:

private:

string itemName ;

int itemPrice;

int itemQuantity ;

};

#endif // ITEMTOPURCHASE_H

#include "ItemToPurchase.h"

ItemToPurchase::ItemToPurchase()

{

//ctor

this->itemName="none";

this->itemPrice=0;

this->itemQuantity=0;

}

void ItemToPurchase::setItemName(string name)

{

this->itemName=name;

}

void ItemToPurchase::setItemPrice(int itemPrice)

{

this->itemPrice=itemPrice;

}

void ItemToPurchase::setItemQuantity(int itemQuantity)

{

this->itemQuantity=itemQuantity;

}

string ItemToPurchase::getItemName()

{

return itemName;

}

int ItemToPurchase::getItemPrice()

{

return itemPrice;

}

int ItemToPurchase::getItemQuantity()

{

return itemQuantity;

}

ItemToPurchase::~ItemToPurchase()

{

//dtor

}

#include <iostream>

#include "ItemToPurchase.h"

using namespace std;

int main()

{

ItemToPurchase item1,item2;

string itemName ;

int itemPrice;

int itemQuantity ;

int totalCost=0;

cout<<"Item 1:"<<endl;

cout<<"Enter the item name : ";

getline(cin,itemName);

//cin.ignore();

cout<<"Enter the item price : ";

cin>>itemPrice;

cout<<"Enter the item quantity : ";

cin>>itemQuantity;

item1.setItemName(itemName);

item1.setItemPrice(itemPrice);

item1.setItemQuantity(itemQuantity);

cin.ignore();

cout<<"Item 2:"<<endl;

cout<<"Enter the item name : ";

getline(cin,itemName);

//cin.ignore();

cout<<"Enter the item price : ";

cin>>itemPrice;

cout<<"Enter the item quantity : ";

cin>>itemQuantity;

item2.setItemName(itemName);

item2.setItemPrice(itemPrice);

item2.setItemQuantity(itemQuantity);

cout<<"TOTAL COST : "<<endl;

cout<<item1.getItemName()<<" "<<item1.getItemQuantity()<<" at $"<<item1.getItemPrice()<<" = "<<(item1.getItemQuantity()*item1.getItemPrice())<<endl;

cout<<item2.getItemName()<<" "<<item2.getItemQuantity()<<" at $"<<item2.getItemPrice()<<" = "<<(item2.getItemQuantity()*item2.getItemPrice())<<endl;

totalCost=(item1.getItemQuantity()*item1.getItemPrice())+(item2.getItemQuantity()*item2.getItemPrice());

cout<<"Total : $"<<totalCost<<endl;

return 0;

}

Note: Replace at with the at symbol

See attachment for output

3 0
3 years ago
HELP ME PLZ QUICK Adam is writing a program that: 1) has the user guess a number, and 2) tells the user how many guesses it took
topjm [15]

Adam might have forgotten to loop the guessing code, meaning that instead of letting him guess multiple times, it simply does it once and ends the program. This could be fixed by adding a while loop, or something of the sort, that doesn't let the user finish the program until they guess the number correctly, while adding to the variable that stores the number of guesses each loop.

8 0
4 years ago
Web browser software requests web pages from the internet using which protocol?
Gekata [30.6K]
TCP/IP (Transmission Control Protocol / Internet Protocol)

This is a bad question. HTTP, HTTPS, FTP and with plugins hundreds of other protocols. If you want to mess with your teacher.
4 0
3 years ago
How can you protect yourself from internet hoaxes cyber awareness?
Kipish [7]
Only add or follow people you know and trust make sure your account is nothing but positive
3 0
3 years ago
Other questions:
  • What are the three major functions of a game engine?
    15·1 answer
  • Collaboration, listening, and negotiating are considered _____ skills.
    5·1 answer
  • PLEASE HELP ASAP!!!!111 Read "Teenagers are rewriting the rules of the news" (find it somewhere and answer questions below)
    7·1 answer
  • Which type of business is best for Juanita to start? a corporation, because she needs a large investment to get started a sole p
    13·2 answers
  • What data unit is addressed based on the IP address of the recipient?
    8·1 answer
  • Discuss your views on multiple backgrounds. What are the advantages and disadvantages of having multiple backgrounds? Your submi
    8·1 answer
  • I'd: 9872093250, password: qqqqq, join the meeting​
    11·1 answer
  • . . ........Sad + sad= very sad
    7·2 answers
  • In order to print multiple worksheets, what needs to happen before printing?
    14·1 answer
  • What is the following file format called? inv_nbr, inv_name, inv_cost 876521,battery,45.00
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!