Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <iomanip>
  4. #include <cstdlib>
  5.  
  6. using namespace std;
  7.  
  8. struct bday
  9. {
  10. string name;
  11. int month, day, year;
  12. //string month1 [12] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" };
  13. };
  14.  
  15. void input();
  16. void list(bday *birthday);
  17.  
  18. int main()
  19.  
  20. {
  21. input();
  22.  
  23. system("pause>0");
  24.  
  25. }
  26. void input()
  27. {
  28.  
  29. bday birthday[5];
  30. for (int i = 0; i < 5; i++)
  31. {
  32. cout << "Record #: " << i + 1 << endl;
  33. cout << "Name: ";
  34. getline(cin, birthday->name);
  35. cout << "Month: ";
  36. cin >> birthday->month;
  37. cout << "Year: ";
  38. cin >> birthday->year;
  39. cout << endl;
  40. cin.ignore();
  41.  
  42. /*for (j = 12; j < 12; j++)
  43. {
  44. if (birthday[i].month = 1)
  45. {
  46. birthday[i].month1.find("January");
  47. }
  48. }*/
  49.  
  50. if (birthday[i].month = 1)
  51. {
  52. birthday[i].month1 = "January";
  53. }
  54.  
  55. else if (birthday[i].month = 2)
  56. {
  57. birthday[i].month1 = 'February';
  58. }
  59. else if (birthday[i].month = 3)
  60. {
  61. birthday[i].month1 = 'March';
  62. }
  63. else if (birthday[i].month = 4)
  64. {
  65. birthday[i].month1 = ' ';
  66. }
  67. else if (birthday[i].month = 5)
  68. {
  69. birthday[i].month1 = 'May';
  70. }
  71.  
  72. else */
  73.  
  74.  
  75. }
  76. system("cls");
  77.  
  78. list (birthday);
  79.  
  80. }
  81. void list(bday *birthday)
  82. {
  83. cout << "List of Birthdays..." << endl;
  84. cout << setw(30) << "Name" << setw(30) << "Birthday" << setw(30) << "Age" << endl;
  85. for (int i = 0; i < 5; i++)
  86. {
  87. cout << setw(27) << birthday[i].name << setw(27) << birthday[i].month1 << birthday[i].day << ", " << birthday[i].year << endl;
  88. }
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement