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
Keith_Richards [23]
4 years ago
14

Write a program that will read in aweight in kilograms and grams and will output the equivalent weightin pounds and ounces. Use

at least three functions: one for input,one or more for calculating, and one for output. Include a loopthat lets the user repeat this computation for new input valuesuntil the user says he or she wants to end the program. There are2.2046 pounds in a kilogram, 1,000 grams in a kilogram, and 16ounces in a pound.
Computers and Technology
1 answer:
ozzi4 years ago
6 0

<u>C++ program for converting kilograms and grams to pounds and ounces</u>

#include <iostream>

using namespace std;

void computation(double kilog, double gram, double& pon, double& oun) /*defining function for computing*/

{

pon = kilog*2.2046;/*Formula for converting*/

oun= gram*0.03527;

}

void output(double pon,double oun)/*For printing output*/

{

   cout << "Pounds are: " << pon << endl;

   cout << "Ounce are: " << oun << endl;

}

void input(double &kilog,double&gram)/*for taking output*/

{

   cout << "Enter kilograms to convert: ";

   cin >> kilog;

  cout << "Enter grams to convert: ";

   cin >> gram;

}

int main() //driver function

{

double kilog = 0.0,gram = 0.0,oun=0.0,pon=0.0;//Initializing

int choice = 0;

while (1) {  

cout << "Enter- 1 for converting kilogram and grams to pounds and ounces" << endl;

cout << "Enter-2 for exiting" << endl;

cout << "Please Enter choice: ";/*Asking choice from user*/

cin >> choice;

if (choice == 1) {

input(kilog,gram);/*Calling function for taking input*/

computation(kilog, gram, pon, oun); /*calling function for computing*/

output(pon,oun);/*calling function for output*/

}

else {

return 0;

}

}

}

<u>Output</u>

Enter- 1 for converting kilogram and grams to pounds and ounces

Enter-2 for exiting

Please Enter choice:1

Enter kilograms to convert:20

Enter grams to convert:10

Pounds are: 44.092

Ounce are: 0.3527

Enter- 1 for converting kilogram and grams to pounds and ounces

Enter-2 for exiting

Please Enter choice: 2

You might be interested in
The basic difference between RAM and ROM memory is: Question 5 options: A) RAM is nonvolatile while ROM is volatile. B) RAM is r
schepotkina [342]

The basic difference between RAM and ROM memory is RAM is read/write while ROM Is read-only.

Explanation:

  • A ROM, non-volatile memory, does not use to store data, but RAM is volatile and requires power to store data.
  • ROM is not given usually as a specification, but RAM is typically specified when buying a computer.
  • We can write data only once in ROM. However, once it is written, we can read it any number of times. RAM is the main memory in a computer, and read from and write to it much faster than other storage types. RAM is used to store files in use on the computer.

Hence the basic difference between RAM and ROM memory is RAM is read/write while ROM Is read-only.

6 0
3 years ago
How to declare a double variable named total with an initial value of 34.45 ?​
MArishka [77]

Answer:

double total =34.45; And for the photo: int num = -5;

3 0
4 years ago
What are the two common architectures used to process data
vitfil [10]
The two most common architectures used (by CPUs as I am assuming your question means) are x86 (32-bit) and x64 (64-bit).
32-bit processes multiple instructions with a single request while 64-bit adds registers for instructions that use 64-bit address space.
8 0
3 years ago
A menu that appears when an object is clicked with the right mouse button is called a tool-tip help menu
ollegr [7]

Answer:

False

Explanation:

It is just a pop-up bar

3 0
3 years ago
A compiler coverts a source code into an object code. true or false​
atroni [7]

Answer:

True

Have a nice day*_*

3 0
3 years ago
Other questions:
  • Where are the Add Level and Delete Level buttons located? Filter options list Sort &amp; Filter group Sort dialog box Custom fil
    11·1 answer
  • A circuit contains four resistors connected in series. R1 is 100 , R2 is 200 , R3 is 240 , and R4 is 600 . What is the total cir
    13·1 answer
  • To connect several computers together, one generally needs to be running a(n) ____ operating system
    12·1 answer
  • Which tab of the ribbon should you go to for removing gridlines on a worksheet?​
    14·1 answer
  • Complete the code to finish this program to analyze the inventory for a store that sells purses and backpacks.
    7·1 answer
  • On the order form worksheet, unlock cells B5 through K5? On Microsoft excel
    9·1 answer
  • Which statements about grades are accurate? Check all that apply. Grades help indicate how well a student is understanding a cer
    13·1 answer
  • Why can't I log in to king.com?
    12·2 answers
  • What are the academic benefits of practicing netiquette? Check all that apply.
    7·1 answer
  • What are the 7 c s of communication​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!