6.26.2017

함수 이용하여 최댓값 구하기

*#include <iostream>
using namespace std;
int max(int x,int y)
{ if (x > y)
  return x;
 else return y;
}
int main(){
 int x, y, z, MAx=0;
 cin >> x>> y >> z;
 max(x,y);

 if (x>y)
  MAx = max(x,z);
 else MAx = max(y,z);
 cout << "최댓값은 무엇인가요오오오?" << MAx << endl;

system("pause");
return 0;
}

댓글 없음:

댓글 쓰기