Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ PROGRAM Exercise #1: cities and average temperatures Write a C++ program that prompts the user to enter the city name and its morning and

C++ PROGRAM

image text in transcribed

image text in transcribed

Exercise #1: cities and average temperatures Write a C++ program that prompts the user to enter the city name and its morning and night temperatures for two cities. The program then outputs each city name and its average temperature in a separate line. Use a tab escape sequence to separate the city name from its average. Enter name, morning temperature and night temperature of the first city: Sharjah 37 34 Enter name, morning temperature and night temperature of the second city: Dubai 39 36 The city names and average temperatures are: Sharjah 35.5 Dubai 37.5 execution time : 17.329 s Process returned 0 (0x0) Press any key to continue. 1 Exercise #2: use predefined function sqrt(), pow() Write a program that defines the named constant Pl, which stores the value of it. The program should use Pl and the predefined functions to accomplish the following: 1. Output the value of Vrt 2. Prompt the user to input the value of a double variable r, which stores the radius of a sphere. The program then outputs the following: a. The value of 4tr2, which is the surface area of the sphere. b. The value of (4/3)ar3 which is the volume of the sphere. Select C:\Users\10918\Desktop\lab3\Lab3Ex1.exe Enter the value of r: 3.5 The value of square root of pi is:1.772 The surface area of the sphere is: 153.86 The volume of the sphere is: 134.627 Process returned (@xe) execution time : 5.429 5 Press any key to continue

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learning PostgreSQL

Authors: Salahaldin Juba, Achim Vannahme, Andrey Volkov

1st Edition

178398919X, 9781783989195

More Books

Students also viewed these Databases questions

Question

How do the police powers of the Constitution affect transportation?

Answered: 1 week ago

Question

=+Differentiate between social media roles

Answered: 1 week ago

Question

Understand the role of corporate design in communications.

Answered: 1 week ago