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

29343 755547 王丰昱 #22

Open
wants to merge 3 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
18 changes: 18 additions & 0 deletions 記帳程式.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include <iostream>
using namespace std;

int main() {
int item = 0;
int money = 0;
int total = 0;

cout << "有幾筆資料:\n";
cin >> item;

for (int i = 0; i < item; i++) {
cout << "請輸入第" << i+1 << "行金額:" ;
cin >> money;
total += money;
}
cout << "總金額為" << total;
}
18 changes: 18 additions & 0 deletions 馬力歐.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include <iostream>
using namespace std;

int main() {
int height;
cout << "高度: ";
cin >> height;

for (int i = height; i > 0; i--) {
for (int j = i; j > 0; j--) {
cout << " ";
}
for (int k = height - i + 1; k > 0; k--) {
cout << "#";
}
cout << "\n";
}
}