For research purposes and to assist students, the admission office of your local
ID: 3631177 • Letter: F
Question
For research purposes and to assist students, the admission office of your local universitywants to determine the performance of female and male students in certain courses. You
receive a list of input data that consists of female and male student's GPAs for certain
courses. Due to confidentiality, the letter code f is used for female students, m is used for
male students. Every data entry consists of a letter code followed by a GPA. Each line has
one entry. The last line consist of q 0. The number of data is unknown. Draw a flowchart
and write the algorithm that computes and outputs the average GPA for both female and
male students. Finally, write a C++ program and format your results to two decimal places.
Explanation / Answer
//not sure about input, or if formal list, so: stack fstack; stack mstack; while (str != "q 0") { if (str.at(0) == 'f') fstack.push(atoi((str.substr(2)).c_str()); //2 is position of start of integer else //for mstack } while (!fstack.empty()) add up GPA and average it //do same for mstackRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.