test your ability to work with records and arrays. Given the following two arrays with their initializations: AnsiString StudentName[5]={“Aliâ€, “Ranaâ€, “Samiâ€, “Hudaâ€, “Ramiâ€}; int StudentMark[5]={80,76, 85, 92, 67}; Write a C++ program to accomplish the followings (all in one program): a. declare a structure of two variables: StudentName and StudentMark of type string and integer respectively and then define an object of 5 records. b. copy all data of each array to its corresponding variable name of the defined records such that (“Ali†and 80) represents the first record and so on for the rest of data. c. using the declared structure, count and print number of PASS students if you know that the passing mark is 50. d. again, use the declared structure to find and print the maximum two marks (use a nested loops for this)
Dnt test our ability just say do u want ur homework to be done? Please this attitude will never fetch u any solution..try urself a bit then we would help u...
Code: #include <vcl.h> #include "MT262io.h" #pragma hdrstop #include <iostream.h> #include<string.h> //--------------------------------------------------------------------------- #pragma argsused struct Student { String StudentName ; int StudentMark ; } ; //--------------------------------------------------------------------------- int main(int argc, char* argv[]) { AnsiString StudentName[5]={"Ali ", "Rana", "Sami", "Huda", "Rami"}; int StudentMark[5]={80,76, 85, 92 , 67}; Student MT262[5] ; for (int COUNT=0 ; COUNT <5 ;COUNT ++) { MT262[COUNT].StudentName = StudentName[COUNT] ; MT262[COUNT].StudentMark = StudentMark[COUNT] ; } int PASS =0 ; for (int P=0 ; P <5 ; P++) if ( MT262[P].StudentMark >= 50 ) PASS ++ ; WriteIntPrCr("PASS = " ,PASS ) ; String W ; int F ; for (int c=0 ; c < 4 ; c++) for (int N=c+1 ; N <5 ; N++) if (MT262[N].StudentMark > MT262[c].StudentMark) { F = MT262[c].StudentMark ; MT262[c].StudentMark = MT262[N].StudentMark ; MT262[N].StudentMark = F ; W = MT262[c].StudentName ; MT262[c].StudentName = MT262[N].StudentName ; MT262[N].StudentName = W ; } for (int c=0 ; c < 2 ;c++) { WriteString(MT262[c].StudentName) ; WriteIntPrCr(" = " , MT262[c].StudentMark) ; } getchar() ; return 0; } //----------------------------------------------------------------------- this is my work give me your opiniON MESTTER techforum4u THANK YOU FOR YOUR HELP.