摘要: #include <iostream>using namespace std;int main(){ int a,b,c,d; cout<<"请输入4个整数,ok?"<< endl; cin>>a>>b>>c>>d; int max=a; if (max<b) max=b; if (max<c) max=c; if (max<d) max=d; cout<<max<<endl; return 0;} 阅读全文
posted @ 2013-05-20 23:42 StanleyWu 阅读(541) 评论(0) 推荐(0) 编辑
摘要: 问题:给定两个正整数,求出两数的正差值并输出。样例输入 样例输出7 10 312 7 5提示:“正差值”意味着无论这两数孰大孰小,输出的差值为非负数。可以自行加入些“请输入……”,“……是:”之类的提示,让你的程序有“友好”的用户界面。#include <iostream>using namespace std;int main(){ int a,b; cout<<"请输入两个正整数: "<<endl; cin>>a>>b; if (a>b) cout<<a-b<<endl; else 阅读全文
posted @ 2013-05-20 23:31 StanleyWu 阅读(144) 评论(0) 推荐(0) 编辑