Write a program to solve the program exercise in chapter 2 #3. Consider the following program skeleton: /* Author(s): ... Date: * Title: Lab assignment 2b -- Standard I0 * Specification: * Translate high-level instructions to C++ statements */ Tlinclude statement(s) l/using namespace statement int main() { /lvariable declaration llexecutable statements I/return statement } Replace the commented statements in the above skeleton with the instructions below: Write a C++ statement that includes the header file iostream. • Write a C++ statement that allows you to use cin, cout, and endlwithout the prefix std:. • Write C++ statement(s) that declare the following variables: num1, num2, num3, and averageof type int. • Write C++ statements that store 125into num1, 28 into num2, and -25 into num3. • Write a C++ statement that stores the average of num1, num2, and num3 into average. • Write C++ statement(s) that output the values of num1, num2, num3, and average. • Compile and run your program. Attach the output screen of a successful execution of your program below (Hint:Use the snipping tool to take screenshots):

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%
Write a program to solve the program exercise in chapter 2 #3. Consider the following program skeleton:
Author(s): ..*
Date:
Title: Lab assignment 2b --
Standard IO *
Specification:
Translate high-level instructions to C++ statements
*/
I/include statement(s)
Ilusing namespace statement
int main() {
/lvariable declaration
llexecutable statements
I/return statement
}
Replace the commented statements in the above skeleton with the instructions below:
Write a C++ statement that includes the header file iostream.
• Write a C++ statement that allows you to use cin, cout, and endlwithout the prefix std::.
Write C++ statement(s) that declare the following variables: num1, num2, num3, and averageof type int.
Write C++ statements that store 125into num1, 28 into num2, and -25 into num3.
• Write a C++ statement that stores the average of num1, num2, and num3 into average.
• Write C++ statement(s) that output the values of num1, num2, num3, and average.
• Compile and run your program.
Attach the output screen of a successful execution of your program below (Hint:Use the snipping tool to take screenshots):
Transcribed Image Text:Write a program to solve the program exercise in chapter 2 #3. Consider the following program skeleton: Author(s): ..* Date: Title: Lab assignment 2b -- Standard IO * Specification: Translate high-level instructions to C++ statements */ I/include statement(s) Ilusing namespace statement int main() { /lvariable declaration llexecutable statements I/return statement } Replace the commented statements in the above skeleton with the instructions below: Write a C++ statement that includes the header file iostream. • Write a C++ statement that allows you to use cin, cout, and endlwithout the prefix std::. Write C++ statement(s) that declare the following variables: num1, num2, num3, and averageof type int. Write C++ statements that store 125into num1, 28 into num2, and -25 into num3. • Write a C++ statement that stores the average of num1, num2, and num3 into average. • Write C++ statement(s) that output the values of num1, num2, num3, and average. • Compile and run your program. Attach the output screen of a successful execution of your program below (Hint:Use the snipping tool to take screenshots):
Consider the following program skeleton.
/* Author(s): ...
* Date:
Title: Lab assignment 2a
C++ Basics Lab assignment 2
--
Specification:
* This program will bring in two prices and two quantities of items from the keyboard and
print those numbers in a formatted chart. */
#include ,iostream>
// Fill in the code to bring in the library for formatted output.
using namespace std;
int main() {
f loat price1, price2;
// The price of 2 items
int quantity1, quantity2;
// The quantity of 2 items
cout << setprecision(2) << fixed << showpoint;
cout << "Please input the price and quantity of the first item" << endl;
// Fill in the input statement that reads in price1 and quantity1 from the keyboard.
// Fill in the prompt for the second price and quantity.
// Fill in the input statement that reads in price2 and quantity2 from the keyboard.
cout << setw(15) << "PRICE" << setw(12) << "QUANTITY\n\n";
// Fill in the output statement that prints the first price and quantity. Be sure to use // setw() statements.
// Fill in the output statement that prints the second price and quantity.
return 0;
}
Finish the code above by filling in the blanks and the instructions necessary to execute the following sample run. Note that two or more data items can be input at
one time by having at least one blank space between them before hitting the enter key.
Attach the output screen of a successful execution of your program below (Hint:Use the snipping tool to take screenshots)
Transcribed Image Text:Consider the following program skeleton. /* Author(s): ... * Date: Title: Lab assignment 2a C++ Basics Lab assignment 2 -- Specification: * This program will bring in two prices and two quantities of items from the keyboard and print those numbers in a formatted chart. */ #include ,iostream> // Fill in the code to bring in the library for formatted output. using namespace std; int main() { f loat price1, price2; // The price of 2 items int quantity1, quantity2; // The quantity of 2 items cout << setprecision(2) << fixed << showpoint; cout << "Please input the price and quantity of the first item" << endl; // Fill in the input statement that reads in price1 and quantity1 from the keyboard. // Fill in the prompt for the second price and quantity. // Fill in the input statement that reads in price2 and quantity2 from the keyboard. cout << setw(15) << "PRICE" << setw(12) << "QUANTITY\n\n"; // Fill in the output statement that prints the first price and quantity. Be sure to use // setw() statements. // Fill in the output statement that prints the second price and quantity. return 0; } Finish the code above by filling in the blanks and the instructions necessary to execute the following sample run. Note that two or more data items can be input at one time by having at least one blank space between them before hitting the enter key. Attach the output screen of a successful execution of your program below (Hint:Use the snipping tool to take screenshots)
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY