Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- struct base {
- string name;
- int date{};
- int month{};
- };
- bool searchForTheRightMonth(base &base);
- const int MONTH[]{6, 7, 8};
- const int SIZE = 5;
- int main() {
- base b[SIZE];
- for (auto &i: b) {
- cout << "Enter name :" << endl;
- cin >> i.name;
- cout << "Enter date :" << endl;
- cin >> i.date;
- cout << "Enter month :" << endl;
- cin >> i.month;
- cout << endl;
- }
- for (auto &i: b) {
- if (searchForTheRightMonth(i)) {
- cout << i.name << "\t" << i.date << "\t" << i.month << endl;
- }
- }
- }
- bool searchForTheRightMonth(base &base) {
- for (int i: MONTH) {
- if (base.month == i) {
- return true;
- }
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment