返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {   
  6.      re:
  7.      int i,j;
  8.      cout<<"請輸入第一個數: ";
  9.      cin >>i;
  10.      cout<<"請輸入第二個數: ";
  11.      cin >>j;
  12.      if(i>j)
  13.          {
  14.          for(int a;a=i-j;a++)
  15.              {
  16.                  a=a+1;
  17.              }      
  18.      cout<<"從"<<i<<"到"<<j<<"所有整數的總和為: "<<a<<endl;
  19.          }   
  20.      goto re;
  21.      system("pause");
  22.      return 0;
  23. }
複製代碼

TOP

返回列表