0% found this document useful (0 votes)
13 views1 page

Chapter 2

Uploaded by

mtalhamalik890
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views1 page

Chapter 2

Uploaded by

mtalhamalik890
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Q1.

Convert the following pseudocode to C++ code.

Be sure to define the appropriate variables.

Store 20 in the speed variable.

Store 10 in the time variable.

Multiply speed by time and store the result in the distance variable.

Display the contents of the distance variable. 28.

Convert the following pseudocode to C++ code. Be sure to define the appropriate variables.

Store 172.5 in the force variable.

Store 27.5 in the area variable.

Divide area by force and store the result in the pressure variable.

Display the contents of the pressure variable.

Q2:

Write a program that displays the following pieces of information, each on a separate line: Your name
Your address, with city, state, and ZIP code Your telephone number Your college major Use only a single
cout statement to display all of this information.

Q3:

To get the average of a series of values, you add the values up and then divide the sum by the number of
values. Write a program that stores the following values in five different variables: 28, 32, 37, 24, and 33.
The program should first calculate the sum of these five variables and store the result in a separate
variable named sum. Then, the program should divide the sum variable by 5 to get the average. Display
the average on the screen.

Q4:

Write a program that computes the tax and tip on a restaurant bill for a patron with a $88.67 meal
charge. The tax should be 6.75 percent of the meal cost. The tip should be 20 percent of the total after
adding the tax. Display the meal cost, tax amount, tip amount, and total bill on the screen.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy