diff --git "a/\350\250\230\345\270\263\347\250\213\345\274\217.cpp" "b/\350\250\230\345\270\263\347\250\213\345\274\217.cpp" new file mode 100644 index 0000000..8a5a069 --- /dev/null +++ "b/\350\250\230\345\270\263\347\250\213\345\274\217.cpp" @@ -0,0 +1,18 @@ +#include +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; +} diff --git "a/\351\246\254\345\212\233\346\255\220.cpp" "b/\351\246\254\345\212\233\346\255\220.cpp" new file mode 100644 index 0000000..34d9ac5 --- /dev/null +++ "b/\351\246\254\345\212\233\346\255\220.cpp" @@ -0,0 +1,18 @@ +#include +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"; + } +}