/*
*Copyright (c) 2014, 烟台大学计算机学院
*All rights reserved.
*文件名称:week7-project3(1).cpp
*作者:翟兴雷
*完成日期:2014年 10 月 12 日
*版本号:v1.0
*
*问题描述:任意输入两个正整数,计算并输出两者的正差值
*输入描述:两个整数,任意大小
*程序输出:一个整数,代表两者正差值
*/
#include <iostream>
using namespace std;
int main()
{
int a,b,c ;
cout << "请输入两个正整数;" << endl ;
cin >> a >> b ;
if (a>b)
c=a-b ;
else c=b-a ;
cout << "两者正差值是" << c << endl;
return 0;
}
运算结果:
总结心得:
勤加练习