#include #include #include #include using namespace std; struct marks {     string id;     double quiz[2], ass[2], labTest[2];     double test, proj, final, total;     char grade; }; struct marks s_marks[50]; void studentGrade(int i) {     s_marks[i].total = ((s_marks[i].quiz[0] + s_marks[i].quiz[1]) * 0.05) + ((s_marks[i].ass[0] + s_marks[i].ass[1]) * 0.15) + ((s_marks[i].labTest[0] + s_marks[i].labTest[1]) * .20) + (s_marks[i].test * 0.15) + (s_marks[i].proj * 0.15) + (s_marks[i].final * 0.30);     if (s_marks[i].total >= 90 && s_marks[i].total <= 100) s_marks[i].grade = 'A';     else if (s_marks[i].total >= 80 && s_marks[i].total <= 90) s_marks[i].grade = 'B';     else if (s_marks[i].total >= 60 && s_marks[i].total <= 80) s_marks[i].grade = 'C';     else if (s_marks[i].total >= 40 && s_marks[i].total <= 60) s_marks[i].grade = 'D';     else s_marks[i].grade = 'F'; } int gradeA = 0, gradeB = 0, gradeC = 0, gradeD = 0, gradeF = 0; void countGrade(int i) {     if (s_marks[i].grade == 'A') gradeA++;     else if (s_marks[i].grade == 'B') gradeB++;     else if (s_marks[i].grade == 'C') gradeC++;     else if (s_marks[i].grade == 'D') gradeD++;     else if (s_marks[i].grade == 'F') gradeF++; } int no_of_students; void outputResult() {     cout << "****************";     cout << setw(85) << "RESULT FOR BITP1113" << endl;     cout << "****************";     cout << endl;     cout << setw(15) << "Matrix Num" << setw(15) << "Quiz(5%)" << setw(15) << "Ass(15%)" << setw(15) << "labTests(20%)" << setw(15) << "Project(5%)" << setw(15) << "Mid-Term(15%)" << setw(15) << "Final(30%)" << setw(15) << "Total(100%)" << setw(15) << "Grade";     cout << endl;     cout << "----------------------------------------------------------------------------------------------------------------------------------------" << endl;     for (int i = 0; i < no_of_students; i++) {         cout << setw(15) << s_marks[i].id << setw(15) << ((s_marks[i].quiz[0] + s_marks[i].quiz[1]) * 0.05) << setw(15) << ((s_marks[i].ass[0] + s_marks[i].ass[1]) * 0.15) << setw(15) << ((s_marks[i].labTest[0] + s_marks[i].labTest[1]) * .20) << setw(15) << (s_marks[i].proj * 0.15) << setw(15) << (s_marks[i].test * 0.15) << setw(15) << (s_marks[i].final * 0.30) << setw(15) << s_marks[i].total << setw(15) << s_marks[i].grade;         cout << endl;     }     cout << "\n\n";     cout << "Statistics" << endl;     cout << "------------------------------------" << endl;     cout << "Total Students for Grade A: " << gradeA << endl;     cout << "Total Students for Grade B: " << gradeB << endl;     cout << "Total Students for Grade C: " << gradeC << endl;     cout << "Total Students for Grade D: " << gradeD << endl;     cout << "Total Students for Grade F: " << gradeF << endl;     cout << "\n\n";     cout << "Graph" << endl;     cout << "------------------------------------" << endl;     cout << "A:  "; for (int i = 0; i < gradeA; i++) { cout << "*"; } cout << endl;     cout << "B:  "; for (int i = 0; i < gradeB; i++) { cout << "*"; } cout << endl;     cout << "C:  "; for (int i = 0; i < gradeC; i++) { cout << "*"; } cout << endl;     cout << "D:  "; for (int i = 0; i < gradeD; i++) { cout << "*"; } cout << endl;     cout << "F:  "; for (int i = 0; i < gradeF; i++) { cout << "*"; } cout << endl;   } int main() {     int i = 0;     ifstream fin;     fin.open("students_grade.txt", ios::in);     if (!fin) {         cout << "File not found.";     }     else {         while (1) {             fin >> s_marks[i].id;             fin >> s_marks[i].quiz[0];             fin >> s_marks[i].quiz[1];             fin >> s_marks[i].ass[0];             fin >> s_marks[i].ass[1];             fin >> s_marks[i].labTest[0];             fin >> s_marks[i].labTest[1];             fin >> s_marks[i].test;             fin >> s_marks[i].proj;             fin >> s_marks[i].final;             studentGrade(i);             countGrade(i);             i++;             if (fin.eof()) break;         }     }     no_of_students = i;     outputResult();     fin.close();     return 0; }

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

please provide me flow chart for the foolowing  code 

please do not copy and paste from another place as answer will dislike

 

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

using namespace std;

struct marks {
    string id;
    double quiz[2], ass[2], labTest[2];
    double test, proj, final, total;
    char grade;
};

struct marks s_marks[50];

void studentGrade(int i) {
    s_marks[i].total = ((s_marks[i].quiz[0] + s_marks[i].quiz[1]) * 0.05) + ((s_marks[i].ass[0] + s_marks[i].ass[1]) * 0.15) + ((s_marks[i].labTest[0] + s_marks[i].labTest[1]) * .20) + (s_marks[i].test * 0.15) + (s_marks[i].proj * 0.15) + (s_marks[i].final * 0.30);
    if (s_marks[i].total >= 90 && s_marks[i].total <= 100) s_marks[i].grade = 'A';
    else if (s_marks[i].total >= 80 && s_marks[i].total <= 90) s_marks[i].grade = 'B';
    else if (s_marks[i].total >= 60 && s_marks[i].total <= 80) s_marks[i].grade = 'C';
    else if (s_marks[i].total >= 40 && s_marks[i].total <= 60) s_marks[i].grade = 'D';
    else s_marks[i].grade = 'F';
}

int gradeA = 0, gradeB = 0, gradeC = 0, gradeD = 0, gradeF = 0;

void countGrade(int i) {
    if (s_marks[i].grade == 'A') gradeA++;
    else if (s_marks[i].grade == 'B') gradeB++;
    else if (s_marks[i].grade == 'C') gradeC++;
    else if (s_marks[i].grade == 'D') gradeD++;
    else if (s_marks[i].grade == 'F') gradeF++;
}

int no_of_students;

void outputResult() {
    cout << "****************";
    cout << setw(85) << "RESULT FOR BITP1113" << endl;
    cout << "****************";
    cout << endl;
    cout << setw(15) << "Matrix Num" << setw(15) << "Quiz(5%)" << setw(15) << "Ass(15%)" << setw(15) << "labTests(20%)" << setw(15) << "Project(5%)" << setw(15) << "Mid-Term(15%)" << setw(15) << "Final(30%)" << setw(15) << "Total(100%)" << setw(15) << "Grade";
    cout << endl;
    cout << "----------------------------------------------------------------------------------------------------------------------------------------" << endl;
    for (int i = 0; i < no_of_students; i++) {
        cout << setw(15) << s_marks[i].id << setw(15) << ((s_marks[i].quiz[0] + s_marks[i].quiz[1]) * 0.05) << setw(15) << ((s_marks[i].ass[0] + s_marks[i].ass[1]) * 0.15) << setw(15) << ((s_marks[i].labTest[0] + s_marks[i].labTest[1]) * .20) << setw(15) << (s_marks[i].proj * 0.15) << setw(15) << (s_marks[i].test * 0.15) << setw(15) << (s_marks[i].final * 0.30) << setw(15) << s_marks[i].total << setw(15) << s_marks[i].grade;

        cout << endl;
    }
    cout << "\n\n";
    cout << "Statistics" << endl;
    cout << "------------------------------------" << endl;
    cout << "Total Students for Grade A: " << gradeA << endl;
    cout << "Total Students for Grade B: " << gradeB << endl;
    cout << "Total Students for Grade C: " << gradeC << endl;
    cout << "Total Students for Grade D: " << gradeD << endl;
    cout << "Total Students for Grade F: " << gradeF << endl;
    cout << "\n\n";
    cout << "Graph" << endl;
    cout << "------------------------------------" << endl;
    cout << "A:  "; for (int i = 0; i < gradeA; i++) { cout << "*"; } cout << endl;
    cout << "B:  "; for (int i = 0; i < gradeB; i++) { cout << "*"; } cout << endl;
    cout << "C:  "; for (int i = 0; i < gradeC; i++) { cout << "*"; } cout << endl;
    cout << "D:  "; for (int i = 0; i < gradeD; i++) { cout << "*"; } cout << endl;
    cout << "F:  "; for (int i = 0; i < gradeF; i++) { cout << "*"; } cout << endl;

 

}

int main() {
    int i = 0;
    ifstream fin;
    fin.open("students_grade.txt", ios::in);
    if (!fin) {
        cout << "File not found.";

    }
    else {

        while (1) {
            fin >> s_marks[i].id;
            fin >> s_marks[i].quiz[0];
            fin >> s_marks[i].quiz[1];
            fin >> s_marks[i].ass[0];
            fin >> s_marks[i].ass[1];
            fin >> s_marks[i].labTest[0];
            fin >> s_marks[i].labTest[1];
            fin >> s_marks[i].test;
            fin >> s_marks[i].proj;
            fin >> s_marks[i].final;
            studentGrade(i);
            countGrade(i);
            i++;
            if (fin.eof()) break;
        }
    }
    no_of_students = i;
    outputResult();
    fin.close();
    return 0;
}

Expert Solution
steps

Step by step

Solved in 3 steps with 5 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education