看板 NTUEE107HW 關於我們 聯絡資訊
不不~~好像還是錯的※ 引述《adihuang (楓所愛的秋)》之銘言: : ※ 引述《mapleden (il'est fou)》之銘言: : : #include <iostream> : : #include <stdio.h> : : using std::cin; : : using std::cout; : : using std::endl; : : int main() : : { : : int a,b,c,Large,Small; : : cout << "Please type in 3 different numbers\n"; : : cin >> a >> b >> c; : : Large=b; : : Small=a; : : if (a>b) : : Large=a; : : Small=b; : : ~~~~~~~~~~~~~~~~~~~~~~~~~~我在這邊加一ㄍif(a<b) : large=b : small=a : 就不會有四比三大的情形了~~只是 :                      不能用else~不知道為什麼 : if (c<Small) : : Small=c; : : if (c>Large) : : Large=c; : : cout << "Sum is " << a+b+c << endl; : : cout << "Mean = " << (a+b+c)/3 << endl; : : cout << "Product is " << a*b*c << endl; : : cout << "Largest is " << Large << endl; : : cout << "Smallest is " << Small << endl; : : system ("PAUSE"); : : return 0; : : } : : 你們試著輸入3;5;4 : : 結果會變得很奇怪 : : smallest會是4 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.245.215
phylin:...明天再來試試...今天好累>< 推 61.59.121.131 09/29