看板 NTUEE107HW 關於我們 聯絡資訊
using namespace std; 好像佔的空間太多囉... 要用的再宣告一下就好啦?! ※ 引述《smarttb1 (呵呵)》之銘言: : ※ 引述《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: 61.59.121.131
smarttb1:其實小程式沒差啦 @@ 推140.112.239.155 09/28
phylin:也對啦= = 推 61.59.121.131 09/28