- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main(){
- int one = 0, two = 0 , a = 0;
- re:
- cout << "請輸入第一個數 : ";
- cin >> one;
- cout << "請輸入第二個數 : ";
- cin >> two;
- for (int i = one, i <= two , i++){
- a = one + 1;
- }
- cout << "從" << one << "到" << two << "所有整數的總和為 : " << a << endl;
- cout << endl;
- goto re;
- system("pause");
- return 0;
- }
複製代碼 |