Using Microsoft Visual Studio and based on the code below, build the program. Th
ID: 3559099 • Letter: U
Question
Using Microsoft Visual Studio and based on the code below, build the program. Then, please provide a download link of the Project File, so I can view the program and source code on Microsoft Visual Studio.
Thank You
[code]#include<iostream>
#include<cmath>
#include<fstream>
#include<iomanip>
//sentinel controlled loops
void FinalGrade (char, int);
using namespace std;
int main()
{
ifstream myInfile;
double grade, total, average, FinalGrade, weekly assignment, midterm, FinalE;
char name;
myInfile.open("C:/prj3Indata.txt"); //Verify the file
myInfile>>weekly assignment>>midterm>>FinalE;
if (! myInfile)
{
cout<<"Invalid File"<<endl;
cin.get(); cin.get();
return 1;
}
while ( grade>=0 )
{
FinalGrade= weekly assignment *.6 + mid term *.15 finalE *.25;
cout << "final grade:"<< FinalGrade << endl;
myInfile>> grade;
return FinalGrade;
}
{
if (grade>=90&&grade<=100)
return 'A';
else if (grade>=80&&grade<90)
return 'B';
else if (grade>=70&&grade<80)
return 'C';
else if (grade>=60&&grade<70)
return 'D';
else if (grade>=50&&grade<60)
return 'E';
else if (grade>=40&&grade<=50)
return 'F';
}
void FinalGrade (char letter, int grade);
{
cout << setw(5)<< "Student Name" << setw(5)
<< "class particimation" << setw(5) << "labs"
<< setw(5) << "programming" << setw(5) << "projects" << setw(5)
<< "midterms" << setw(5)<< "Final Exam" <<endl;
//cout<< setw(12)<<name<<setw(3)<<classparticipation<<setw(3)<<labs<<setw(3)<<programing<<setw(3)<<midterm1<<set(3)<<midterm2<<set(3)<<FinalE<<
//setw(3)<<letter<<setw(3)<<grade<<endl;
}
cin.get(); cin.get();
return 0;
}[code]
Explanation / Answer
This code is working fine for me just place the prj3Indata.txt file in c: drive
#include<iostream>
#include<cmath>
#include<fstream>
#include<iomanip>
//sentinel controlled loops
void FinalGrade (char, int);
using namespace std;
int main()
{
ifstream myInfile;
double grade, total, average, FinalGrade1, weekly_assignment, midterm, FinalE;
char name;
myInfile.open("C:/prj3Indata.txt"); //Verify the file
myInfile>>weekly_assignment>>midterm>>FinalE;
if (! myInfile)
{
cout<<"Invalid File"<<endl;
cin.get(); cin.get();
return 1;
}
while ( grade>=0 )
{
FinalGrade1 = weekly_assignment *.6 + midterm *.15 * FinalE * 0.25;
cout << "final grade:"<< FinalGrade1 << endl;
myInfile>> grade;
FinalGrade('a',grade);
}
if (grade>=90&&grade<=100)
return 'A';
else if (grade>=80&&grade<90)
return 'B';
else if (grade>=70&&grade<80)
return 'C';
else if (grade>=60&&grade<70)
return 'D';
else if (grade>=50&&grade<60)
return 'E';
else if (grade>=40&&grade<=50)
return 'F';
cin.get(); cin.get();
return 0;
}
void FinalGrade (char letter, int grade)
{
cout << setw(5)<< "Student Name" << setw(5)<< "class particimation" << setw(5) << "labs"
<< setw(5) << "programming" << setw(5) << "projects" << setw(5)
<< "midterms" << setw(5)<< "Final Exam" <<endl;
}