Write the missing statements in the following program so that it prompts the user to input two numbers. If one of the numbers is 0 or negative, the program outputs both numbers must be positive. If both the numbers are equal, it outputs the sum of the numbers; if the first number is less than or equal to 2 and both the numbers are not equal, it outputs second number to the power of the first number; otherwise it outputs the product of the numbers. #include <iostream>//Include additional header files, if necessaryusing namespace std;int main(){double firstNum, secondNum;cout << "Enter two nonzero numbers: ";cin >> firstNum >> secondNum;cout << endl;//Missing statementsreturn 0;}

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter5: Control Structures Ii (repetition)
Section: Chapter Questions
Problem 13SA
icon
Related questions
Question

Write the missing statements in the following program so that it prompts the user to input two numbers. If one of the numbers is 0 or negative, the program outputs both numbers must be positive. If both the numbers are equal, it outputs the sum of the numbers; if the first number is less than or equal to 2 and both the numbers are not equal, it outputs second number to the power of the first number; otherwise it outputs the product of the numbers. 
#include <iostream>
//Include additional header files, if necessary
using namespace std;
int main()
{
double firstNum, secondNum;
cout << "Enter two nonzero numbers: ";
cin >> firstNum >> secondNum;
cout << endl;
//Missing statements
return 0;
}

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Knowledge Booster
Mathematical functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT