Answer to Question #89478 in C++ for SUBHAM KUMAR SAW

Question #89478
An array store detail of 25 students ( roll number, name mark in three subjects) write a program to create a such a an array and print out a list of student who have failed in more than one subject as 40% as pass marks without using structure
1
Expert's answer
2019-05-13T14:07:28-0400
#include <iostream>
#include <string>
using namespace std;
float st[25];
float nd[25];
float rd[25];
string students[25];
int main() {
    bool flag = 0; //We make a flag, because we need only one failed exam.
    for (int i = 0; i < 25; ++i) { //In order not to make the code highly branched, we create one cycle in which we will raise the flag if we find a student who has failed at least one exam.
        if(st[i] < 40)
            flag = 1;
        if(nd[i] < 40)
            flag = 1;
        if(rd[i] < 40)
            flag = 1;
        if (flag)
            cout << students[i];
        flag = 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