|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
- #define _CRT_SECURE_NO_WARNINGS 1
- #include<iostream>
- #include<iomanip>
- using namespace std;
- void input(int &a, int &b, int &c){
- cin >> a >> b >> c;
- }
- void findmax(int a, int b, int c){
- int max = 0;
- if (a>b&&a>c)
- {
- max = a;
- }
- else if (b>a& b>c)
- {
- max = b;
- }
- else
- {
- max = c;
- }
- cout << "三个数中最大的数max=" <<max << endl;
- // fixed << setprecision(3)
- }
- int main(){
- int a, b, c;
- cout << "请输入想要比较的三个数" << endl;
- input(a, b, c);
- findmax(a, b, c);
- system("pause");
- return 0;
- }
复制代码 |
|