Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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; } 

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

1 2 #include #include using namespace std; 3 4 5 6 int main() { /*a) Declare structure named Name with 2 members of type char array named firstname and lastname with size 30 (3 marks)*/ 17 8 19 { 10 11 12 13 14 15 }; 16 17 18 /*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)*/ 19 20 { 21 22 3 23 24 ; 25 26 ; 27 28 }; 29 30 const int SIZE = 50; 31 32 /*c) Define array named P of type Person with size 50. Note: use the declared SIZE constant (2 marks) 33 ; 34 35 36 37 1/Get input data cout > 54 55 56 cout > 59 60 } 61 62 63 cout

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 10g SQL

Authors: Joan Casteel, Lannes Morris Murphy

1st Edition

141883629X, 9781418836290

More Books

Students also viewed these Databases questions

Question

=+What is the Fed doing? Why?

Answered: 1 week ago