Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

Hello I need help creating a flowchart for this C++ program. I am confusing about creating a flowchart. Thanks. main.cpp #include #include #include using namespace

Hello I need help creating a flowchart for this C++ program. I am confusing about creating a flowchart. Thanks.

main.cpp

#include

#include

#include

using namespace std;

// main function

int main() {

// variable to store student id

int id;

// variables to store old gpa(ogpa), old course credits(occ), new course

// credits(ncc), current gpa(cur_gpa), cumulative gpa(cum_gpa)

float ogpa, occ, ncc, cur_gpa, cum_gpa;

// variables to store course credits

float c1, c2, c3, c4;

// variables to store grades

float g1, g2, g3, g4;

// variables to store old honor points and new honor points

float ohp, nhp;

// variables for input file name and output file name

char in_file_name[100], out_file_name[100];

// objects for read from file and write to file

ifstream in_stream;

ofstream out_stream;

// prompt for input file name

cout << "Enter the input file name: ";

cin >> in_file_name;

// prompt for output file name

cout << " Enter the output file name: ";

cin >> out_file_name;

// opening input file

in_stream.open(in_file_name);

// reading student id, old gpa, old course credits

in_stream >> id >> ogpa >> occ;

// reading course credits

in_stream >> c1 >> c2 >> c3 >> c4;

// reading grades

in_stream >> g1 >> g2 >> g3 >> g4;

// calculating old honor points

ohp = occ * ogpa;

// calculating new honor points

nhp = (c1 * g1) + (c2 * g2) + (c3 * g3) + (c4 * g4);

// calculating new course credits

ncc = c1 + c2 + c3 + c4;

// calculating current gpa

cur_gpa = nhp / ncc;

// calculating cumulative gpa

cum_gpa = (nhp + ohp) / (ncc + occ);

// opening output file

out_stream.open(out_file_name);

out_stream << setprecision(1) << fixed;

// writing student id to file

out_stream << setw(40) << left << "Student ID number:" << id << endl << endl;

// writing old course credits to file

out_stream << setw(40) << "Previous semester's credit:" << occ << endl;

// writing old gpa to file

out_stream << setw(40) << "Previous semester's GPA:" << ogpa << endl;

// writing current gpa to file

out_stream << setw(40) << "GPA of current semester:" << cur_gpa << endl;

// writing cumulative gpa to file

out_stream << setw(40) << "Cumulative GPA:" << cum_gpa << endl;

// writing total credits to file

out_stream << setw(40) << "Total credits completed:" << (occ + ncc) << endl;

cout << " Student ID number:\t\t" << id << endl << endl;

cout << "Previous semesters' credit:\t" << occ << endl; cout << "Previous semesters' GPA:\t" << ogpa << endl; cout << "GPA of current semester:\t" << cur_gpa << endl; cout << "Cumulative GPA:\t\t\t" << cum_gpa << endl; cout << "Total credits completed:\t" << occ + ncc << endl;

// closing input file

in_stream.close();

// closing output file

out_stream.close();

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Solaris 11.2 System Administration (oracle Press)

Authors: Harry Foxwell

1st Edition

007184421X, 9780071844215

More Books

Students explore these related Databases questions

Question

What is paper chromatography?

Answered: 3 weeks ago

Question

Explain the cost of capital.

Answered: 3 weeks ago

Question

Define capital structure.

Answered: 3 weeks ago

Question

1. Identify the sources for this conflict.

Answered: 3 weeks ago

Question

3. The group answers the questions.

Answered: 3 weeks ago