Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

29840 755433 黃國瑜 #13

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions 755433/expense-app.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <iostream>
using namespace std;

int main() {
//設定變數和多少筆資料
int count_data, count_sum, total = 0;
cin >> count_data;

//算出總金額
for (int i = 0; i < count_data; i++) {
cin >> count_sum;
total = count_sum + total;
}

//輸出總金額
cout << "總共 " << total << " 元";
}
25 changes: 25 additions & 0 deletions 755433/mario.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include <iostream>
using namespace std;

int main() {
//設定變數和輸入
int num;
cout << "高度: ";
cin >> num;

//設定幾行,輸出後換行
for (int i = num; i > 0; i--) {

//空格數目及輸出
for (int j = 0; j < i - 1; j++) {
cout << " ";
}

//井字號數目及輸出
for (int k = 0; k < num - i + 1; k++) {
cout << "#";
}

cout << "\n";
}
}