Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include using namespace std; int main() { int num1, // num1 is not initialized num2 = 17; // num2 has been initialized to 17 cout

#include using namespace std;

int main() { int num1, // num1 is not initialized num2 = 17; // num2 has been initialized to 17

cout << "Please enter an integer" << endl; cin >> num1;

cout << "num1 = " << num1 << " and num2 = " << num2 << endl;

if (num1 == num2) cout << "Hey, that's a coincidence!" << endl;

if (num1 != num2) cout << "The values are not the same" << endl;

return 0; }

Modify the program so that the user inputs both values to be tested for equality. Make sure you have a prompt for each input. Test the program with pairs of values that are the same and that are different. Exercise 3: Modify the program so that when the numbers are the same it prints the following lines: The values are the same. Hey thats a coincidence

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Reliability Engineering Designing And Operating Resilient Database Systems

Authors: Laine Campbell, Charity Majors

1st Edition

978-1491925942

More Books

Students also viewed these Databases questions

Question

Find the value of the sum.

Answered: 1 week ago