Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <string>
- using namespace std;
- int main() {
- vector<int> month_lengths = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
- vector<string> month_name = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" };
- int number_month;
- cin >> number_month;
- if (number_month >= 1 && number_month <= month_lengths.size()) {
- std::cout << "There are " << month_lengths[number_month-1] << " days in " << month_name[number_month-1] << endl;
- }
- else {
- std::cout << "Incorrect month";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement