I have done a bit of a research online but did not find an explanation for the error code -1073741676
, displayed by Code::Blocks.
The exact error message is Process terminated with status -1073741676 (0 minute(s), 8 second(s))
.
Is there a global, constant explanation for this precise status, or does it change with compiler, IDE or any other variable?
Code (as Minimal as I could) :
main.cpp
int n(0), choix(0);
string dis;
// Nobel* laureats = saisie(n); // Saisie à la main
Nobel* laureats = lecture(n);
cin >> dis;
cout << agemoyen(laureats, n, dis) << endl;
Nobel.h
#ifndef NOBEL_H_INCLUDED
#define NOBEL_H_INCLUDED
#include <string>
struct Nobel
{
std::string nom, discipline;
int annee, age;
std::string pays;
};
int agemoyen(Nobel* NO, int n, std::string dis);
Nobel* lecture(int& n);
#endif // NOBEL_H_INCLUDED
Nobel.cpp
int agemoyen(Nobel* NO, int n, string dis){
int ages(0);
int total(0);
for(int i = 0 ; i < n ; i++){
if(NO[i].discipline == dis){
ages += NO[i].age;
total++;
}
}
ages /= total;
return ages;
}
Nobel* lecture(int& n){
Nobel* laureats;
ifstream fichier("tp7nobel.txt", ios::in);
if (fichier.is_open()) {
fichier >> n;
cout << n << endl;
laureats = new Nobel[n];
for(int i = 0 ; i < n; i++){
fichier >> laureats[i].nom >> laureats[i].discipline >> laureats[i].annee >> laureats[i].age >> laureats[i].pays;
cout << i << ")" << laureats[i]. nom << endl;
}
fichier.close();
}else{
cerr << "Impossible d'ouvrir ce fichier." << endl;
}
return laureats;
}