Question:

Write a program which will accept names and scores of 5 students. Program will read from a file and create ?

by  |  earlier

0 LIKES UnLike

an output file. Program will calculate the following: total scores(test1 & test2 20% each, lab 25%, and final35%) and assign letter grade( 90% A, 80% B, 70% C, 60% D, <60% F).

Not sure if i'm doing this correctly

#include <iostream>

#include <string>

#include <iomanip>

#include <fstream>

using namespace std;

void main ()

(

ifstream ins("students.txt");

ofstream out("output.out");

//Variable Declarations

string f_name, l_name, name;

double test1, test2, lab, final, total;

char grade;

ins>>f_name>>l_name>>test1>>test2>>lab>>...

 Tags:

   Report

2 ANSWERS


  1. total = (test1 * 0.20) + (test2 * 0.20) + (lab * 0.25) + (final * 0.35)

    Then just use a case (or nested if) structure to assign the letter grade based on total and write the output.


  2. It would be a very good idea to say what language that is and also you could of done it with one batch file with about 10-20 line of code :P

Question Stats

Latest activity: earlier.
This question has 2 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.