- #include <iostream>
- #include <ctime>
- using namespace std;
- int main() {
- int taiwanHour, taiwanMinute;
- cout << "Enter Taiwan time (hour 0-23 and minute 0-59): ";
- cin >> taiwanHour >> taiwanMinute;
- int timeDifferences[] = {1, 0, 1, 7, 7, 7, 7, 11, 6, 6, 16};
- const char* countries[] = {"Japan", "Philippines", "Vietnam", "France", "Spain", "Switzerland", "Belgium", "Brazil", "South Africa", "Swaziland", "New Zealand"};
- cout << "Taiwan time: " << taiwanHour << ":" << taiwanMinute << endl;
- for (int i = 0; i < sizeof(timeDifferences) / sizeof(int); ++i) {
- int countryHour = taiwanHour + timeDifferences[i];
- int countryMinute = taiwanMinute;
-
- if (countryMinute >= 60) {
- countryHour += countryMinute / 60;
- countryMinute %= 60;
- }
- cout << countries[i] << " time: " << countryHour % 24 << ":" << countryMinute << endl;
- }
- return 0;
- }
複製代碼 |