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)
- What is the output of the following program? (6) #includeiostreamusingnamespacestd;voidfunc1();voidfunc2();intmain()intnum;coutEnter1or2:;cinnum;coutendl;coutTake;if(num1)func1();elseif(num2)func2();elsecoutInvalidinput.Youmustentera1or2endl;return0;voidfunc1()coutProgrammingI.endl;voidfunc2()coutProgrammingII.endl; What is the output if the input is 1? What is the output if the input is 2? What is the output if the input is 3? What is the output if the input is -1?arrow_forwardThis 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 that will take in basic information from a student, including student name, degree name, number of credits taken so far, and the total number of credits required in the degree program. The program will then calculate how many credits are needed to graduate. Display should include the student name, the degree name, and credits left to graduate. Step 3: What two things are wrong with the following calculation? (Reference: Variable Assignment and Calculations, page 43 from text book Starting Out with Programming Logic & Design). creditsLeft = creditsTaken – creditsDegreearrow_forward
- 3. Draw a flowchart and a java program that computes the student's grade using the formula use by the school which is SS/PS * 50+50; SS is student's score, and PS is the perfect score.arrow_forwardIf you run the following program, in which order the statements of this program will be executed? Your answer should be a sequence of comma separated line numbers without any extra spaces, e.g., 1,2,3,4,5,6,7,8 etc.arrow_forwardWhich of the following statements is correct? To raise the value of a variable, use increment; to reduce the value of a variable, use decrement. The word "system testing" should be defined.arrow_forward
- please make a java program using the flowchart given in the picturearrow_forwardWrite a program that prompts the user to enter a value for a variable named x and then prompts the user to enter a value for y. Both prompts should use the Matlab input function. The program then checks if the value of x is greater than the value of y. If so, display a message to the command window telling the user that x is greater than y, otherwise display a message to the command window telling the user that y is greater than or equal to x. Use symbolic expressions and the subs function to determine the value of E in ? = ? ? 2 when m is 10. Note that c is approximately 186,000 miles per second. You must substitute in values for both m and c. Your answer should be: 3.4596e+11 aka 345960000000arrow_forwardWhat is the output of this program?arrow_forward
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning