Question
this is a c++ question...please help...urgent Complete the following program with appropriate C++ statements. This program stores the information of 50 Persons using structures. Declare
this is a c++ question...please help...urgent
Complete the following program with appropriate C++ statements. This program stores the information of 50 Persons using structures. Declare a structure to represent a name with two (2) members of type char array with size 30 named firstname and lastname. Then, create a structure named Person with three (3) members. The members include fullname type Name, age type integer and citizen type integer. Store 50 input data in an array named P of type Person. Print out a list of persons who have age greater than or equal 21 years old. Note: Please write C ++ statements WITHOUT blank spaces unless it is absolutely needed. Example: int num,a,b;
#include#include using namespace std; int main() { /*a) Declare structure named Name with 2 members of type char array named firstname and lastname with size 30 (3 marks)*/ Answer { Answer; Answer; }; /*b) Declare structure named Person with 2 members of type integer named age and citizen, and one member of type Name named fullname (4 marks)*/ Answer { Answer; Answer; Answer; }; const int SIZE = 50; /*c) Define array named P of type Person with size 50. Note: use the declared SIZE constant (2 marks) Answer; //Get input data cout cout cout > Answer; cout > Answer; } cout for (int i = 0; i /*h) Display firstname, lastname and citizen for the person who age 21 or more (5 marks)*/ if (Answer) cout } return 0; }
1 2 #include
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started