很簡單的加法程式,卻找不到問題所在[已解決]

Home Home
引用 | 編輯 son032001
2009-01-24 00:23
樓主
推文 x0
問 題:

     小弟今天剛開始自學c++,想練習個簡單的題目(連續加法)
     但是不知為何加出來的次數跟答案都異常的大。

程式碼:
     #include<iostream>

     int main()
     {
           int Integer;
           int Sum;
           int n;      

           std::cout << "Please enter numbers you wanna plus (0 to end):";
           std::cin >> Integer;

           while (Integer != 0)
           {
                 n++;
                 Sum = Sum + Integer;
                 std::cout << "Please enter numbers you wanna ..

訪客只能看到部份內容,免費 加入會員



獻花 x0