Question: 1. Write a code snippet that includes a loop to input 12 positive integers and display the highest value entered without using arrays. The values
1. Write a code snippet that includes a loop to input 12 positive integers and display the highest value entered without using arrays. The values will be doubles. You must validate that the input values are positive
2. (TCO 3) What is the output of the following program?
#include
using namespace std;
int main()
{
int x1, x2, i, j, k, y, z;
double f;
x1 = 4;
x2 = 2;
y = 5 + x1--;
z = 5 + ++x2;
i = 6 % 4;
j = 1;
j += j + 3;
k = 25 / 2;
f = (double)((2 / 5) * k);
cout<<"x1 is "<
<" j is "<
<
return 0;
},
3. Write a decision statement to check that the value of an integer variable "x" is between 45 and 75. If it is, display YES, otherwise display NO.
Make sure to include 45 and 75 as true values.
Write a separate decision statement if display Here if the value of a variable "state" is NY or NJ. If it is not, display There.
Make sure to declare all variables used
4. (TCO 7) Explain the difference between a function prototype and a function definition. Use a C++ program segment to illustrate your answer.
5. Declare an array to store 5 string values. Use a loop to enter the values one at a time. Use a separate loop to display the strings on the same line separated by a tab.
|
| Question 6.6. (TCO 9) Create a code segment that defines a class definition for a Book. Include at least two attributes:ISBN and title, a constructor and a destructor. Create Book.h and Book.cpp. 7. (TCO 13) Provide a C++ code segment that reads data from a text file using a while loop. The file name should be c:\finalexam.txt. You need to check that the file is open and test for eof in the loop. |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
