Menu

[Solved]Include Using Namespace Std Void Testequal Int X Int Y X Y Cout Q37175083

#include <iostream>using namespace std;void TestEqual (int x, int y){if(x==y){cout<<“The two numbers are equal”<<endl;}else {cout<<“The two numbers are not equal”<<endl;}}int main() {//Declare variablescout<<“TestEqual num1, num2″<<endl;int x;//Prompt user for first numbercout<<“Enter num1: “;cin>>x;cout<<“”<<endl;int y;//Prompt user for second numbercout<<“Enter num2: “;cin>>y;//OutputTestEqual(x,y);}

Modify your function TestEqual so that ratherthan printing out a message, it returns true ifthe values are equal and false if they are not.(Note: This means your function will no longer be avoid function. Now it returns a value of type____.)

  • Question: Now that you’re not printing out anymessage in your function, where will you print it out?
  • You should also modify your main function so that it tests thereturn value from the function and prints an appropriate message.Something like:
    • if ( TestEqual(num1, num2) == true) cout << x<< ” and ” << y << ” are equal!n”;

Submit: Commented code

Expert Answer


Answer to #include using namespace std; void TestEqual (int x, int y) { if(x==y){ cout… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *