Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <iomanip>
- #include <cstdlib>
- using namespace std;
- struct bday
- {
- string name;
- int month, day, year;
- //string month1 [12] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" };
- };
- void input();
- void list(bday *birthday);
- int main()
- {
- input();
- system("pause>0");
- }
- void input()
- {
- bday birthday[5];
- for (int i = 0; i < 5; i++)
- {
- cout << "Record #: " << i + 1 << endl;
- cout << "Name: ";
- getline(cin, birthday->name);
- cout << "Month: ";
- cin >> birthday->month;
- cout << "Year: ";
- cin >> birthday->year;
- cout << endl;
- cin.ignore();
- /*for (j = 12; j < 12; j++)
- {
- if (birthday[i].month = 1)
- {
- birthday[i].month1.find("January");
- }
- }*/
- if (birthday[i].month = 1)
- {
- birthday[i].month1 = "January";
- }
- else if (birthday[i].month = 2)
- {
- birthday[i].month1 = 'February';
- }
- else if (birthday[i].month = 3)
- {
- birthday[i].month1 = 'March';
- }
- else if (birthday[i].month = 4)
- {
- birthday[i].month1 = ' ';
- }
- else if (birthday[i].month = 5)
- {
- birthday[i].month1 = 'May';
- }
- else */
- }
- system("cls");
- list (birthday);
- }
- void list(bday *birthday)
- {
- cout << "List of Birthdays..." << endl;
- cout << setw(30) << "Name" << setw(30) << "Birthday" << setw(30) << "Age" << endl;
- for (int i = 0; i < 5; i++)
- {
- cout << setw(27) << birthday[i].name << setw(27) << birthday[i].month1 << birthday[i].day << ", " << birthday[i].year << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement