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

29021 755201 寧家楨 錢包app #24

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
51 changes: 51 additions & 0 deletions 755201/755201 290 21.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#include <iostream>
using namespace std;
int main() {
float money;

do {
cout << "輸入金額: ";
cin >> money;
}
while (money <= 0 || 10 * money != int(10 * money));

int money1 = money * 10, time = 0;

while (money1 >= 10000) {
money1 -= 10000;
time++;
}
while (money1 >= 5000) {
money1 -= 5000;
time++;
}
while (money1 >= 1000) {
money1 -= 1000;
time++;
}
while (money1 >= 500) {
money1 -= 500;
time++;
}
while (money1 >= 100) {
money1 -= 100;
time++;
}
while (money1 >= 50) {
money1 -= 50;
time++;
}
while (money1 >= 10) {
money1 -= 10;
time++;
}
while (money1 >= 5) {
money1 -= 5;
time++;
}
while (money1 >= 1) {
money1 -= 1;
time++;
}
cout << time;
}