Question: Question 1-3 should be submitted in a single Microsoft Word file. Be sure to clearly label your solutions. Question 1: Consider the following program: #include
Question 1-3 should be submitted in a single Microsoft Word file. Be sure to clearly label your solutions.
Question 1:
Consider the following program:
#include #include #include
using namespace std;
int main()
{ int num1; int num2; cout << fixed << showpoint << setprecision(2); cout << "Enter two integers: "; cin >> num1 >> num2; cout << endl;
if (num1 != 0 && num2 != 0) cout << sqrt(abs(num1 + num2) + 0.5) << endl; else if (num1 != 0) cout << floor(num1 + 0.5) << endl; else if (num2 != 0) cout << ceil(num2 + 0.5) << endl; else cout << 0 << endl; return 0; }
a. What is the output if the input is -23 8? b. What is the output if the input is 12 32? c. What is the output if the input is 15 0? d. What is the output if the input is 0 -36? e. What is the output if the input is 0 0?
Question 2:
Write the definition of a function that takes as input the three numbers. The function returns true if the first number to the power of the second number equals the third number; otherwise, it returns false. (Assume that the three numbers are of type double).
Question 3:
Write C++ statements that do the following:
a.Define an enum type, birdType, with the values PEACOCK, SPARROW, CANARY, PARROT, PENGUIN, OSTRICH, EAGLE, CARDINAL, and HUMMINGBIRD.
b. Declare a variable bird of the type birdType.
c. Assign CANARY to the variable bird.
d. Advance bird to the next value in the list.
e. Decrement bird to the previous value in the list.
f. Output the value of the variable bird.
g. Input value in the variable bird.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
