SlideShare una empresa de Scribd logo
1 de 1
Descargar para leer sin conexión
1-1 Suppose you have a struct called Person that looks like this: struct Person { std::string
name; int age; Note: create a Person.h files for this struct. Don't forget to add a Header guard to
this file. In a file called function-1-1.cpp, include Person.h and write a function called that takes
an integer argument n and returns an array of n Person structs. The name and age fields of each
struct should be set to "John Doe" and 0 , respectively. Signature: Person* createPersonArray
(int n ) Implement a program with a main method that tests your code in a file called main-1-
1.cpp 1-2 Now, suppose you have another struct called PersonList that looks like this: struct
Personlist { Person* people; int numpeople; Note: Add the above struct to the file Person.h In a
file called function-1-2.cpp, include Person.h and write a function called that takes an integer
argument n and returns a PersonList struct. The numPeople field of the struct should be set to n,
and the people field should be set to an array of n Person structs. The name and age fields of
each struct should be set to "Jane Doe" and 1 , respectively. Implement a program with a main
method that tests your code in a file called main-1-2.cpp

Más contenido relacionado

Similar a 1-1 Suppose you have a struct called Person that looks like this str.pdf

1. Section1.- Populating the list of persons on the person listing.pdf
1. Section1.- Populating the list of persons on the person listing.pdf1. Section1.- Populating the list of persons on the person listing.pdf
1. Section1.- Populating the list of persons on the person listing.pdfaniljain719651
 
UNIT 4-HEADER FILES IN C
UNIT 4-HEADER FILES IN CUNIT 4-HEADER FILES IN C
UNIT 4-HEADER FILES IN CRaj vardhan
 
Write a C++ program that reads in a list of first and last names fro.pdf
Write a C++ program that reads in a list of first and last names fro.pdfWrite a C++ program that reads in a list of first and last names fro.pdf
Write a C++ program that reads in a list of first and last names fro.pdframasamyarm
 
Lab_3- Objective- Experiment with Lists- Stacks- and Queues- Simulate.docx
Lab_3- Objective- Experiment with Lists- Stacks- and Queues- Simulate.docxLab_3- Objective- Experiment with Lists- Stacks- and Queues- Simulate.docx
Lab_3- Objective- Experiment with Lists- Stacks- and Queues- Simulate.docxrennaknapp
 
File Type cppAdd the following to your linked list of strings pro.pdf
File Type cppAdd the following to your linked list of strings pro.pdfFile Type cppAdd the following to your linked list of strings pro.pdf
File Type cppAdd the following to your linked list of strings pro.pdffootworld1
 
This is a java lab assignment. I have added the first part java re.pdf
This is a java lab assignment. I have added the first part java re.pdfThis is a java lab assignment. I have added the first part java re.pdf
This is a java lab assignment. I have added the first part java re.pdffeetshoemart
 
0_ML lab programs updated123 (3).1687933796093.doc
0_ML lab programs updated123 (3).1687933796093.doc0_ML lab programs updated123 (3).1687933796093.doc
0_ML lab programs updated123 (3).1687933796093.docRohanS38
 
What's new in Python 3.11
What's new in Python 3.11What's new in Python 3.11
What's new in Python 3.11Henry Schreiner
 
Data Structure Using C - FILES
Data Structure Using C - FILESData Structure Using C - FILES
Data Structure Using C - FILESHarish Kamat
 
FIle Handling and dictionaries.pptx
FIle Handling and dictionaries.pptxFIle Handling and dictionaries.pptx
FIle Handling and dictionaries.pptxAshwini Raut
 
Hey, I need some help coding this C++ assignment.ObjectivesThis.pdf
Hey, I need some help coding this C++ assignment.ObjectivesThis.pdfHey, I need some help coding this C++ assignment.ObjectivesThis.pdf
Hey, I need some help coding this C++ assignment.ObjectivesThis.pdfrishabjain5053
 

Similar a 1-1 Suppose you have a struct called Person that looks like this str.pdf (20)

1. Section1.- Populating the list of persons on the person listing.pdf
1. Section1.- Populating the list of persons on the person listing.pdf1. Section1.- Populating the list of persons on the person listing.pdf
1. Section1.- Populating the list of persons on the person listing.pdf
 
UNIT 4-HEADER FILES IN C
UNIT 4-HEADER FILES IN CUNIT 4-HEADER FILES IN C
UNIT 4-HEADER FILES IN C
 
Python programming : Files
Python programming : FilesPython programming : Files
Python programming : Files
 
Write a C++ program that reads in a list of first and last names fro.pdf
Write a C++ program that reads in a list of first and last names fro.pdfWrite a C++ program that reads in a list of first and last names fro.pdf
Write a C++ program that reads in a list of first and last names fro.pdf
 
Lab_3- Objective- Experiment with Lists- Stacks- and Queues- Simulate.docx
Lab_3- Objective- Experiment with Lists- Stacks- and Queues- Simulate.docxLab_3- Objective- Experiment with Lists- Stacks- and Queues- Simulate.docx
Lab_3- Objective- Experiment with Lists- Stacks- and Queues- Simulate.docx
 
File Type cppAdd the following to your linked list of strings pro.pdf
File Type cppAdd the following to your linked list of strings pro.pdfFile Type cppAdd the following to your linked list of strings pro.pdf
File Type cppAdd the following to your linked list of strings pro.pdf
 
This is a java lab assignment. I have added the first part java re.pdf
This is a java lab assignment. I have added the first part java re.pdfThis is a java lab assignment. I have added the first part java re.pdf
This is a java lab assignment. I have added the first part java re.pdf
 
0_ML lab programs updated123 (3).1687933796093.doc
0_ML lab programs updated123 (3).1687933796093.doc0_ML lab programs updated123 (3).1687933796093.doc
0_ML lab programs updated123 (3).1687933796093.doc
 
Chapter 11
Chapter 11Chapter 11
Chapter 11
 
Python Session - 5
Python Session - 5Python Session - 5
Python Session - 5
 
CPP Assignment Help
CPP Assignment HelpCPP Assignment Help
CPP Assignment Help
 
U5 SPC.pptx
U5 SPC.pptxU5 SPC.pptx
U5 SPC.pptx
 
U5 SPC.pptx
U5 SPC.pptxU5 SPC.pptx
U5 SPC.pptx
 
What's new in Python 3.11
What's new in Python 3.11What's new in Python 3.11
What's new in Python 3.11
 
Functions in python
Functions in pythonFunctions in python
Functions in python
 
Data Structure Using C - FILES
Data Structure Using C - FILESData Structure Using C - FILES
Data Structure Using C - FILES
 
C programming
C programmingC programming
C programming
 
Python IO
Python IOPython IO
Python IO
 
FIle Handling and dictionaries.pptx
FIle Handling and dictionaries.pptxFIle Handling and dictionaries.pptx
FIle Handling and dictionaries.pptx
 
Hey, I need some help coding this C++ assignment.ObjectivesThis.pdf
Hey, I need some help coding this C++ assignment.ObjectivesThis.pdfHey, I need some help coding this C++ assignment.ObjectivesThis.pdf
Hey, I need some help coding this C++ assignment.ObjectivesThis.pdf
 

Más de winsports04

1) Let X1,X2,�Xn are i.i.d random sample from U(0,) a) Show that the .pdf
 1) Let X1,X2,�Xn are i.i.d random sample from U(0,) a) Show that the .pdf 1) Let X1,X2,�Xn are i.i.d random sample from U(0,) a) Show that the .pdf
1) Let X1,X2,�Xn are i.i.d random sample from U(0,) a) Show that the .pdfwinsports04
 
1) Accordine to CTiA, 67�N of people believe wireless access is a mus.pdf
 1) Accordine to CTiA, 67�N of people believe wireless access is a mus.pdf 1) Accordine to CTiA, 67�N of people believe wireless access is a mus.pdf
1) Accordine to CTiA, 67�N of people believe wireless access is a mus.pdfwinsports04
 
1) Which of the following statements is FALSE with regard to communic.pdf
 1) Which of the following statements is FALSE with regard to communic.pdf 1) Which of the following statements is FALSE with regard to communic.pdf
1) Which of the following statements is FALSE with regard to communic.pdfwinsports04
 
1 pts Question 19 Wriat is calied ihe kegal or rightifut power of.pdf
 1 pts Question 19 Wriat is calied ihe kegal or rightifut power of.pdf 1 pts Question 19 Wriat is calied ihe kegal or rightifut power of.pdf
1 pts Question 19 Wriat is calied ihe kegal or rightifut power of.pdfwinsports04
 
1) Consider the continuous-time LTI system with impulse response h(t).pdf
 1) Consider the continuous-time LTI system with impulse response h(t).pdf 1) Consider the continuous-time LTI system with impulse response h(t).pdf
1) Consider the continuous-time LTI system with impulse response h(t).pdfwinsports04
 
1) What are the functions of the nervous system What is special abou.pdf
 1) What are the functions of the nervous system What is special abou.pdf 1) What are the functions of the nervous system What is special abou.pdf
1) What are the functions of the nervous system What is special abou.pdfwinsports04
 

Más de winsports04 (6)

1) Let X1,X2,�Xn are i.i.d random sample from U(0,) a) Show that the .pdf
 1) Let X1,X2,�Xn are i.i.d random sample from U(0,) a) Show that the .pdf 1) Let X1,X2,�Xn are i.i.d random sample from U(0,) a) Show that the .pdf
1) Let X1,X2,�Xn are i.i.d random sample from U(0,) a) Show that the .pdf
 
1) Accordine to CTiA, 67�N of people believe wireless access is a mus.pdf
 1) Accordine to CTiA, 67�N of people believe wireless access is a mus.pdf 1) Accordine to CTiA, 67�N of people believe wireless access is a mus.pdf
1) Accordine to CTiA, 67�N of people believe wireless access is a mus.pdf
 
1) Which of the following statements is FALSE with regard to communic.pdf
 1) Which of the following statements is FALSE with regard to communic.pdf 1) Which of the following statements is FALSE with regard to communic.pdf
1) Which of the following statements is FALSE with regard to communic.pdf
 
1 pts Question 19 Wriat is calied ihe kegal or rightifut power of.pdf
 1 pts Question 19 Wriat is calied ihe kegal or rightifut power of.pdf 1 pts Question 19 Wriat is calied ihe kegal or rightifut power of.pdf
1 pts Question 19 Wriat is calied ihe kegal or rightifut power of.pdf
 
1) Consider the continuous-time LTI system with impulse response h(t).pdf
 1) Consider the continuous-time LTI system with impulse response h(t).pdf 1) Consider the continuous-time LTI system with impulse response h(t).pdf
1) Consider the continuous-time LTI system with impulse response h(t).pdf
 
1) What are the functions of the nervous system What is special abou.pdf
 1) What are the functions of the nervous system What is special abou.pdf 1) What are the functions of the nervous system What is special abou.pdf
1) What are the functions of the nervous system What is special abou.pdf
 

Último

Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfSanaAli374401
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...KokoStevan
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterMateoGardella
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Shubhangi Sonawane
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 

Último (20)

Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 

1-1 Suppose you have a struct called Person that looks like this str.pdf

  • 1. 1-1 Suppose you have a struct called Person that looks like this: struct Person { std::string name; int age; Note: create a Person.h files for this struct. Don't forget to add a Header guard to this file. In a file called function-1-1.cpp, include Person.h and write a function called that takes an integer argument n and returns an array of n Person structs. The name and age fields of each struct should be set to "John Doe" and 0 , respectively. Signature: Person* createPersonArray (int n ) Implement a program with a main method that tests your code in a file called main-1- 1.cpp 1-2 Now, suppose you have another struct called PersonList that looks like this: struct Personlist { Person* people; int numpeople; Note: Add the above struct to the file Person.h In a file called function-1-2.cpp, include Person.h and write a function called that takes an integer argument n and returns a PersonList struct. The numPeople field of the struct should be set to n, and the people field should be set to an array of n Person structs. The name and age fields of each struct should be set to "Jane Doe" and 1 , respectively. Implement a program with a main method that tests your code in a file called main-1-2.cpp