Create the statements to enter an integer number


Discuss the below:

Q1. Consider the following sequence of C++ code

int age;
cout << "Please enter your age: "<cin>> Age;

Would this code sequence compile? Explain.

Q2. What does the following pseudocode do?

Input x
Input y
Set result = (x+y)/2
Output result

Q3. Using pseudocode or C++, write the statements to enter an integer number, compute the number raised to power 5 and output the result.

Q4. Using pseudocode or C++, write the statements to enter two integer numbers, switch their values and output the result.

Q5. Using pseudocode or C++, write the statements to enter an integer number, determine if it is even or odd and print "The number is even" if it is even or "The number is odd" if it is odd (Hint: the % operator returns the remainder of the division of a number by another. For example 5%2 returns 1 because the remainder of 5 divided by 2 is 1).

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Create the statements to enter an integer number
Reference No:- TGS01937336

Now Priced at $25 (50% Discount)

Recommended (94%)

Rated (4.6/5)