Hi, I am facing problem in designing a new program which its requirements are:
1)Program with file output operation:
User to enter a group of students’ names and
marks for a few subjects they have taken.
2)Program with file input operation:
Retrieve the students’ names and all subject
marks. Display all details and calculate average or
number of failures / passes etc.
I suppose to use 'fstream' but I don't really know how exactly it works. Can somebody help?
well actually I did this at first, but it seems like it got some error so I redo another one..
#include <iostream>
#include <cstring>
#include <fstream>
using namespace std;
int main()
{
ofstream fout ("marks.txt");
int num;
cout << "Enter the number of student: " ;
cin >> num;
int marks[num][5];
string name;
char names [num][50];
int i,j;
for(i=0; i < num; i++)
{
cout<< "\nEnter student "<< i+1 << " name: ";
if(i==0)
cin.ignore();