看板 NTUEE107HW 關於我們 聯絡資訊
#include <iostream> using std::cin; using std::cout; using std::end; int main() { int a,b,c,tmp; cout << "Please type in 3 different numbers.\n"; cin >> a >> b>> c; if (a>b){ tmp=a; a=b; b=tmp;} if (b>c){ tmp=b; b=c; c=tmp;} if (a>b){ tmp=a; a=b; b=tmp;} cout << "The Sum is " << a+b+c << endl; cout << "Average is " << (float)(a+b+c)/3 << endl; cout << "Product is " << a*b*c <<endl; cout << "Largest is " << c << endl; cout << ""Smalest is " << a << endl; system ("PAUSE"); return 0; } -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.239.182