Hello. I am getting the following two errors on the code below, and I don't know how to fix them. Can someone help me please? The function is designed to calculate the weighted average of homework, quiz, and test grades read in from an input file, as well as a later function that calculates the total average after a dropped homework grade.
The errors are:
The program is as follows:Code:1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup 1>C:\Users\Trey\documents\visual studio 2010\Projects\Program 5\Debug\Program 5.exe : fatal error LNK1120: 1 unresolved externals
Code:// Trey Brumley // CMPS 1043-101 // December 3, 2012 // Program 5 - Arrays // ================== #include <iostream> #include <fstream> #include <iomanip> using namespace std; // Prototypes void header(); void totalAverage(int x, int y, int z); void droppedGrade(); void droppedGradeAverage(int x, int y, int z); // Main Function int main() { ifstream infile; infile.open("input.txt"); ofstream outfile; outfile.open("output.txt"); header(); int homework[7], quiz[9], test[3], sum1=0, sum2=0, sum3=0; for (int i = 0; i<7; i++) { infile >> homework[i]; sum1 += homework[i]; } for (int i = 0; i<9; i++) { infile >> quiz[i]; sum2 += quiz[i]; } for (int i = 0; i<3; i++) { infile >> test[i]; sum3 += test[i]; } totalAverage(sum1, sum2, sum3); droppedGrade(); return 0; } // Prints a header on output file void header() { ofstream outfile; outfile.open("output.txt"); outfile << "Trey Brumley" << endl; outfile << "CMPS 1043-101" << endl; outfile << "December 3, 2012" << endl; outfile << "Program 5 - Arrays" << endl; outfile << "==================" << endl << endl; return; } // Finds the weighted and total average of each category void totalAverage(int x, int y, int z) { ofstream outfile; outfile.open("output.txt"); double a, b, c, d, e, f, g; a = x/7; b = y/9; c = z/3; d = a*0.15; e = b*0.25; f = c*0.60; g = d+e+f; outfile << "The average for Homework Grades is " << setprecision(1) << a << "." << endl; outfile << "The weighted average of homework (15%) amounts to " << setprecision(1) << d << "." << endl; outfile << "The average for Quiz Grades is " << setprecision(1) << b << "." << endl; outfile << "The weighted average of quizzes (25%) amounts to " << setprecision(1) << e << "." << endl; outfile << "The average for Test Grades is " << setprecision(1) << c << "." << endl; outfile << "The weighted average of tests (60%) amounts to " << setprecision(1) << f << "." << endl; outfile << "The total weighted average of all grades is " << setprecision(1) << g << "." << endl; return; } void droppedGrade() { ifstream infile; infile.open("input.txt"); ofstream outfile; outfile.open("output.txt"); int x = 100; int sum4=0, sum5=0, sum6=0, sum7=0; int homework2[7], quiz2[9], test2[3]; for (int i = 0; i<7; i++) { infile >> homework2[i]; if ( homework2[i]<x) x = homework2[i]; sum4 += homework2[i]; } sum7=sum4-x; for (int i = 0; i<9; i++) { infile >> quiz2[i]; sum5 += quiz2[i]; } for (int i = 0; i<3; i++) { infile >> test2[i]; sum6 += test2[i]; } droppedGradeAverage(sum7, sum5, sum6); return; } void droppedGradeAverage(int x, int y, int z) { ofstream outfile; outfile.open("output.txt"); double a, b, c, d, e, f, g; a = x/6; b = y/9; c = z/3; d = a*0.15; e = b*0.25; f = c*0.60; g = d+e+f; outfile << "The average for Homework Grades after dropping the lowest grade is " << setprecision(1) << a << "." << endl; outfile << "The weighted average of homework (15%) amounts to " << setprecision(1) << d << "." << endl; outfile << "The average for Quiz Grades is " << setprecision(1) << b << "." << endl; outfile << "The weighted average of quizzes (25%) amounts to " << setprecision(1) << e << "." << endl; outfile << "The average for Test Grades is " << setprecision(1) << c << "." << endl; outfile << "The weighted average of tests (60%) amounts to " << setprecision(1) << f << "." << endl; outfile << "The total weighted average of all grades minus the dropped homework grade is " << setprecision(1) << g << "." << endl; return; }



LinkBack URL
About LinkBacks



