Skip to content

Instantly share code, notes, and snippets.

@hansen033
Created November 14, 2017 14:49
Show Gist options
  • Save hansen033/3bd59ad861fe78de90b2134877a5b017 to your computer and use it in GitHub Desktop.
Save hansen033/3bd59ad861fe78de90b2134877a5b017 to your computer and use it in GitHub Desktop.
2017/11/09
#include <iostream>
using namespace std;
int main(){
int plus, ans;
ans = 0;
cout << "請輸入想要加起來的數(想要減的話請用負數),輸入完成後請輸入0來取得答案\n";
while (plus !=0){
cin >> plus;
ans += plus;
}
cout << "\n答案是:" << ans;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment