看板 NTUEE107HW 關於我們 聯絡資訊
※ 引述《mapleden (il'est fou)》之銘言: : 就是Chapter1的習題1.26 : 怎麼樣都會跑錯 : 知道的人能幫我debug一下嗎,謝啦^^ : #include <iostream> : using std::cin; : using std::cout; : using std::endl; ^^^^^^^^^^^^^^^^其實這三行可以合寫成: using namespace std; : 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 (c<sl) : small=c; : if (c>le) : 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; : return 0; : } 這樣試看看行不行?? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.239.155