Concept explainers
Explanation of Solution
The implementation code for displaying value of six variables is shown below:
//Header file
#include <iostream>
//For standard input and output
using namespace std;
//Main function
int main()
{
//Declare six variables in "int" datatype
int num1, num2, num3, num4, num5, num6;
//Display the value of "num1"
cout << "Value of num1: " << num1 << endl;
//Display the value of "num2"
cout << "Value of num2: " << num2 << endl;
//Display the value of "num3"
cout << "Value of num3: " << num3 << endl;
//Display the value of "num4"
cout << "Value of num4: " << num4 << endl;
//Display the value of "num5"
cout << "Value of num5: " << num5 << endl;
//Display the value of "num6"
cout << "Value of num6: " << num6 << endl;
return 0;
}
Explanation:
The given code is used to display the value of six variables...
Want to see the full answer?
Check out a sample textbook solutionChapter 2 Solutions
Problem Solving with C++ (10th Edition)
- For each of the two programs below, suppose that you had the time and memory required to run the code to completion. What would the value of the variable grid be at the end of the program?arrow_forwardUse C++ Programming language. Amanda and Tyler opened a business that specializes in shipping liquids, such as milk, juice, and water, in cylindrical containers. The shipping charges depend on the amount of the liquid in the container. (For simplicity, you may assume that the container is filled to the top.) They also provide the option to paint the outside of the container for a reasonable amount. Write a program that does the following: Prompts the user to input the dimensions (in feet) of the container (radius of the base and the height). Prompts the user to input the shipping cost per liter. Prompts the user to input the paint cost per square foot. (Assume that the entire container including the top and bottom needs to be painted.) Separately outputs the shipping cost and the cost of painting. Your program must use the class cylinderType (designed in Programming Exercise 3) to store the radius of the base and the height of the container. (Note that 1 cubic feet = 28.32 liters or…arrow_forward6. What is the best way to think about syntax errors in programming? a. The computer didn't understand the statement you entered b. You will never learn how to program c. It is the wrong time of day - wait a few hours and try again d. The computer needs to have its software upgraded 7. In the following code print 98.6) What is "98.6"? A conditional state d. An iteration A variable b. A constant с. a.arrow_forward
- This program includes a number of int variables: a, b, c, d, e, i, j, and y. Which of these variables could be printed by the first println statement? Which of them could be printed by the second println statement? Which of them could be printed by the third println statement? Which of them could be printed by the fourth println statement? Which of them could be printed by the fifth println statement? Which of them could be printed by the sixth println statement?arrow_forwardWrite a program to read the information of 10 patients (name , id , disease, age , blood . (, فصيلة الدمtype_arrow_forwardWrite a programarrow_forward
- Write a complete program to read in and display name, age, and various forms of a date. Your program should accomplish these steps, in order: Part One: Name and Age ask the user for their name and read it in ask the user for their age and read it in calculate how old the user will be after their next birthday output the user's name and age after their next birthday Part Two: Birthday Printing ask for and read in the month, date, day, and year of the user's birthday output the birthday in the U.S. format and the European format be careful with commas vs spaces! US Format: Day, Month Date, Year Example: Monday, December 6, 2021 European Format: Day Date Month Year Example: Monday 6 December 2021 Additional Coding Requirements code should compile follow Java naming conventions for variables (lower camel case with no underscores)arrow_forwardWhat is the major advantage of using a for loop instead of a while loop? a. Unlike with a while loop, the execution of multiple statements can depend on the test condition. b. With a for loop, it is impossible to create an infinite loop. c. It is the only way to achieve an indefinite loop. d. The loop control variable is initialized, tested, and altered all in one place.arrow_forward4. c. Display all the numbers the user entered that are greater than 100. Numbers smaller than 100 are ignored. The numbers should be displayed in the same order as they were entered by the user. Develop a simulation program to simulate the appearance of text message a phone receives. a. Ask user how many text messages one would receive in 12 hours. b. Ask user how many hours the user wants to run the simulation. C. Your program will display the number of seconds from the beginning of the simulation when a text message is received like this: 452 890 1593.arrow_forward
- You want your program to execute statement 1 when A is false, B is false, and C is true, and to execute statement 2 otherwise. You wroteif not(A and B) and C thenstatement 1elsestatement 2end ifDoes this do what you want?arrow_forwardWrite pseudocode for a Python program that uses iteration to guess a number from 1 to 10 that matches the computer’s number. Enter a name, the computer selects a number, users guess a number, and they keep guessing until they correctly guess the computer’s number. Turn in the pseudocode, Python program, and a screenshot of your output. Step 1: Ask the player to enter a name or quit to exit Step 2: use a while statement to test when the name is not equal to quit Step 3: input enter a number from 1 to 10 for the variable your_guess # display the number guessedprint("Your number is", your_guess) while num != your_guess: Step 4: Write an if statement for your_guess is less than num Step 5 display text with your guess and You won, name Step 6 ask the player to enter a name or quit to exitarrow_forwardWrite a program Question.arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr