Write a program that contains a function Min. The function must take two integer numbers a and b. The function must return 1 if a > b, 0 if a equals to b, and -1 if a < b.
1
Expert's answer
2013-03-29T07:49:17-0400
#include <iostream>
using namespace std;
int Min(int a, int b) { if (a == b) & return 0; return (a > b) ? 1 : -1; }
int main() { int a = 5; int b = 10;
cout << "a = 5, b = 10" << endl; cout << "Min(a, b) = " << Min(a, b) << endl; return 0; }
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment