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
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment