input marks

Write a program to read in a sequence of examination mark from a text file named as input.txt and produce the mean, and standard deviation of the marks. Your program should also produce a bar chart for each grade where the range of mark is given as below.

Grade Marks Range
A 80-100
B 70-79.9
C 50-69.9
D 40-49.9
F 0-39.9

Output the result to another text file named as output.txt.
Yes, that's right - you write it.

Let's see your code (In code tags please). We can help from there.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include<iostream>
#include<fstream>
#include<string>
#include<cmath>
using namespace std;

int main(){
	int number_stud[5],sum=0;
	double exam_marks,mean;
	string student_name;
	ifstream infile; // input file
	ofstream outfile; //output file
	infile.open("input.txt"); 
	outfile.open("output.txt");
	
	if(!outfile){  //if cannot open the file
		cout<<"Cannot open file."<<endl;
		return 1;
	}

	string data;

	while(!infile.eof()){
		getline(infile,data);
		cout<<data<<endl;  //output to terminal window
		}
	for(int x=0;x<5;x++){
			cout<<"Please enter the student name: ";
			cin>>student_name;
			cout<<"Please enter the examination marks: ";
			cin>>exam_marks;
			sum=sum+exam_marks;
	}
	mean=sum/5;
	outfile<<"The mean is "<<mean<<endl;


    system("pause");
   
	return 0;
} 


after that i dont know what to do can you pls help me on it..how to create a standard deviation..
Last edited on
(In code tags please)
Topic archived. No new replies allowed.