All, Please help. I am new to c++ at college. I have no programming experience.
This is a program I am working and not having any luck. I am to display grades for seven fictitious people.
I am to do the following.
"To create and execute a C++ program that will read student information from an input text file, calculate the test average, program average, course average, and the letter grade earned and output the result to the monitor as well as to an output text file. The letter grade earned is based on the sum of the total points earned as noted below".
1. I need to get the program to average the scores of the characters. The characters and their grades are listed below.
Snow White 77 87 76 82 92 96 90
Jack Frost 67 77 87 88 86 89 96
Sleeping Beauty 90 89 78 88 86 85 93
Prince Charming 92 87 88 89 90 91 78
Rapunzel Repunzel 66 76 73 81 85 70 86
Santa Claus 90 89 95 86 88 94 99
Miss Horner 65 76 72 50 69 75 92
2. I do not know where to put my else if loop.
3. I don't know how I need to use my fstream to recall the characters and their grades to compile the program.
Thanks
//Control Structures and File Input/Output
//Programmer:
#include <iostream>
#include <iomanip>
#include <conio.h>
#include <fstream>
#include <string>
using namespace std;
//if(grade >= 90)
//cout<<"The grade is an A."<<endl;
//else if (grade >=80)
//cout<<"The grade is a B."<<endl;
//else if (grade >=70)
//cout<<"The grade is a C."<<endl;
//else
//cout<<"The grade is an F."<<endl;
cout<<fixed<<setprecision(2)<<showpoint;
cout<<"012345678901234567890123456789012345678901234567890123456789"<<endl;
cout<<setw(60)<<setfill('*')<<"*"<<endl;
cout<<"*"<<setw(59)<<setfill(' ')<<"*"<<endl;
cout<<setfill(' ')<<left<<setw(10)<<"*"<<"IT210 Business Applications with C++"<<setw(14)<<right<<"*"<<endl;
cout<<left<<setw(10)<<"*"<<"Programmer: "<<setw(27)<<right<<"*"<<endl;
cout<<left<<setw(10)<<"*"<<"Date: October 26, 2010"<<setw(27)<<right<<"*"<<endl;
cout<<"*"<<setw(59)<<setfill(' ')<<"*"<<endl;
cout<<left<<setw(10)<<"*"<<"Program Assignment 2: Student Grades II"<<setw(11)<<right<<"*"<<endl;
cout<<"*"<<setw(59)<<setfill(' ')<<"*"<<endl;
cout<<left<<setw(10)<<"*"<<"This program reads student information from"<<setw(7)<<right<<"*"<<endl;
cout<<left<<setw(10)<<"*"<<"an input text file and outputs the results"<<setw(8)<<right<<"*"<<endl;
cout<<left<<setw(10)<<"*"<<"to the monitor as well as to a text file"<<setw(10)<<right<<"*"<<endl;
cout<<"*"<<setw(59)<<setfill(' ')<<"*"<<endl;
cout<<setw(60)<<setfill('*')<<"*"<<endl;
cout<<"\n1234567890123456789012345678901234567890123456789012345678901234567890"<<endl;
cout<<setw(70)<<setfill('=')<<"="<<endl;
cout<<setfill(' ')<<setw(20)<<left<<"Student Name"<<setw(10)<<"Total"<<setw(10)<<"Program"<<setw(10)<<"Test"<<setw(10)<<"Course"<<setw(10)<<"Grade"<<endl;
cout<<setw(20)<<"Points"<<setw(10)<<"Average"<<setw(10)<<"Average"<<setw(10)<<"Average"<<endl;
cout<<setw(70)<<setfill('-')<<"-"<<setfill(' ')<<endl;
fout<<fixed<<setprecision(2)<<showpoint;
fout<<"012345678901234567890123456789012345678901234567890123456789"<<endl;
fout<<setw(60)<<setfill('*')<<"*"<<endl;
fout<<"*"<<setw(59)<<setfill(' ')<<"*"<<endl;
fout<<setfill(' ')<<left<<setw(10)<<"*"<<"IT210 Business Applications with C++"<<setw(14)<<right<<"*"<<endl;
fout<<left<<setw(10)<<"*"<<"Programmer: "<<setw(30)<<right<<"*"<<endl;
fout<<left<<setw(10)<<"*"<<"Date: October 26, 2010"<<setw(26)<<right<<"*"<<endl;
fout<<"*"<<setw(59)<<setfill(' ')<<"*"<<endl;
fout<<left<<setw(10)<<"*"<<"Program Assignment 2: Student Grades II"<<setw(11)<<right<<"*"<<endl;
fout<<"*"<<setw(59)<<setfill(' ')<<"*"<<endl;
fout<<left<<setw(10)<<"*"<<"This program reads student information from"<<setw(7)<<right<<"*"<<endl;
fout<<left<<setw(10)<<"*"<<"an input text file and outputs the results"<<setw(8)<<right<<"*"<<endl;
fout<<left<<setw(10)<<"*"<<"to the monitor as well as to a text file"<<setw(10)<<right<<"*"<<endl;
fout<<"*"<<setw(59)<<setfill(' ')<<"*"<<endl;
fout<<setw(60)<<setfill('*')<<"*"<<endl;
fout<<"\n1234567890123456789012345678901234567890123456789012345678901234567890"<<endl;
fout<<setw(70)<<setfill('=')<<"="<<endl;
fout<<setfill(' ')<<setw(20)<<"Student Name"<<setw(10)<<"Total"<<setw(10)<<"Program"<<setw(10)<<"Test"<<setw(10)<<"Course"<<setw(10)<<"Grade"<<endl;
fout<<setw(20)<<"Points"<<setw(13)<<"Average"<<setw(13)<<"Average"<<setw(13)<<"Average"<<endl;
fout<<setw(70)<<setfill('-')<<"-"<<setfill(' ')<<endl;