c++ helping please

Consider that the file student.txt contains the name and
corresponding exam scores of 20 students in a class (the data is
given right). Write a C++ program to perform the following tasks:
(a) read data from the file into suitable arrays
(b) output the mean of the each exam
(c) output the name and the exam scores of the student
having the best average (according to 30%, 30%, 40%).

UGUR 67 38 55
KADIR 72 45 60
SEMIH 00 71 45
GOZDE 73 70 61
FIRAT 30 69 35
EDA 51 58 67
FULYA 41 65 73

#include<iostream>
#include<conio.h>
#include<string>
#include<fstream>
using namespace std;
int main () {
ifstream dosya("stu.txt");
string name[20];
int exam1;
int exam2;
int exam3;
int total;
for(int i=0;i<20;i++) {
dosya>>name[i]>>exam1[i]>>exam2[i]>>exam3[i];
cout<<name[i]<<" "<<exam1[i]<<exam2[i]<<exam3[i]<<endl;
}
dosya.close();

for(int i=0;i<20;i++) {
total[i]=exam1[i]+exam2[i]+exam3[i];
}
getch ();
}

I wrote this code but it s not running and not enough for this question I am trying to write code but I havent done yet and this my quiz question for tomorrow please Could somebody help me? Please...
instead of ifstream dosya("stu.txt");,
try dosya.open("stu.txt");
You need to check if the file opened correctly before you can use it.
1
2
3
4
5
6
7
  #include <cstdio>
  ifstream dosya("stu.txt");
  if (!dosya)
  {
     perror("ERROR);
     return errno.
  } 
Topic archived. No new replies allowed.