1. Create a struct that will contain a person’s: (code) First name Last name Tel
ID: 3613522 • Letter: 1
Question
1. Create a struct that will contain a person’s:(code)
First name
Last name
Telephone
Street address
Town
State
#include <iostream>
using namespace std;
struct PersonRec
{
string last;
string first;
string phone;
string address;
string town;
string state;
int zip;
};
void get_data (PersonRec&the_person);
int main()
{
PersonRec person;
get_data(person);
cout << "First Name: "<< person.first << endl;
cout << "Last Name: "<< person.last << endl;
cout << "Telephone: "<< person.phone << endl;
cout << "Address: "<< person.address << endl;
cout << "Town: "<< person.town << endl;
cout << "State: "<< person.state << endl;
cout << "Zip: "<< person.zip << endl;
return 0;
}
void get_data (PersonRec&the_person);
{
PersonRec the_person;
cout << "Enter first name:";
cin >> the_person.first;
cout << "Enter last name:";
cin >> the_person.last;
cout << "Enter Telephone Number:";
cin >> the_person.phone;
cout << "Enter The Address:";
cin >> the_person.address;
cout << "Enter The Town:";
cin >> the_person.town;
cout << "Enter The State:";
cin >> the_person.state
cout << "Enter The Zip:";
cin >> the_person.zip;
}
Explanation / Answer
please rate - thanks you have an extra ; and missing a semicolon- see the 2 red lines #include using namespace std; struct PersonRec { string last; string first; string phone; string address; string town; string state; int zip; }; void get_data (PersonRec& the_person); int main() { PersonRec person; get_data(person); coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.