Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need this program written out in C++ please and thank you! ___________________

ID: 3543569 • Letter: I

Question

I need this program written out in C++ please and thank you!

______________________________________________________________________________________________

Write a program to store one person

Write a program to store one person's birthday information in a struct data type. The struct should consist of two other structs: one struct to hold the person's first name and last name, and another to hold the date (day, month, and year). Consider including other information as well, such as a vector of strings with a list of possible gift ideas. Test the structure by entering several objects, let user to enter name and the program should display matching birthday.

Explanation / Answer

#include<iostream>

#include<vector>

#include<string>

using namespace std;

struct BirthdayInfo{

struct {

string first;

string last;

}name;

struct {

int day;

int month;

int year;

}date;

};

int main()

{

vector<string> giftList;

//some entry for gifts

giftList.push_back("Doll");

giftList.push_back("toy");

giftList.push_back("bat");

//create some structure object

BirthdayInfo birth[3];

for(int i=0;i<3;i++)

{

cout<<"enter "<<i+1 <<" birthday details"<<endl;

cout<<"First Name :";

cin>>birth[i].name.first;

cout<<"Last Name:";

cin>>birth[i].name.last;

cout<<"birth date in dd mm yy format(space seperated eg 15 02 1990) :";

cin>>birth[i].date.day>>birth[i].date.month>>birth[i].date.year;

}

string searchingname;

cout<<"Enter a name to search :";

cin>>searchingname;

int i;

for( i=0;i<3;i++)

{

if(searchingname==birth[i].name.first||searchingname==birth[i].name.last)

{

cout<<"his birthday is on "<<birth[i].date.day<<"/"<<birth[i].date.month<<"/"<<birth[i].date.year<<endl;

}

}

if(i==3)

{

cout<<"no such name in database";

}

return 0;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote