Answer to Question #252646 in C++ for koi

Question #252646

Class 5A in Sahara Tech Academy has a total of 5 Students. 2 of the students are male while 3 are female. In another stream 5B, in the same school, there are 6 students of which 4 are female and 2 male. Required. Women in Technology International (WITI), an international organization to empower women in technology has organized a symposium for all the female students in class 5 A and B. 1. Using 2D arrays in C++, write a program that registers all the students in both streams in different arrays i.e. 5A and 5B using first name and gender. Traverse through both registers, filter and come up with a full list i.e. 5C that has all the names of the students in 5A and 5B that qualified for the symposium a. Populating and displaying class 5A [2Marks] b. Populating and displaying class 5B [2 Marks] c. Displaying class 5C [5 Marks] 2. Comment important parts of your code. 


1
Expert's answer
2021-10-17T16:57:24-0400


#include<string.h>
#include<iostream>


#include<conio.h>
#include<string>
using namespace std;






int main()


{


          


          string Class5A[5][2],Class5B[6][2],Class5C[11][2];


          //Populating data for class 5A


          cout<<"Enter the details for class 5A. Enter name and gender of students:\n";


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


          {


                    for(int j=0;j<2;j++)


                       cin>>Class5A[i][j];


                 cout<<"\n";


 


}


//Populationg class5B


cout<<"Enter the details for class 5A. Enter name and gender of students:\n";


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


          {


                    for(int j=0;j<2;j++)


                 cin>>Class5B[i][j];


       cout<<"\n";


}


//Populating class 5C 


int k=0;


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


{


          if(Class5A[i][1]=="F")            
          {


                    Class5C[k][0]=Class5A[i][0];


                    Class5C[k][1]=Class5A[i][1];


                    k++;


          }


  }


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


          {


      if(Class5B[i][1]=="F")     


          {


                    Class5C[k][0]=Class5B[i][0];


                    Class5C[k][1]=Class5B[i][1];


                    k++;


            }


           


  }


  //Displaying  class5C


cout<<"\n Class5C\n";


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


{


          for(int k=0;k<2;k++)


         cout<<Class5C[i][k]<<" ";


         cout<<"\n";


}


getch();


          return 0;


}


 

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS