Hello, I need to do some make few programs with data structures. Problem is that everytime I try to execute my written program code blocks crashes. I tried to look for solution but unfortunately did not found anything. So any ideas?
I use 16.01 version. Also I tried to execute same program on iMac version of codeblocks at school and it did work.
It's clearly the line 42 ... oh, wait, you did not show any code so we cannot possibly comment on it either.
You state that you do use an IDE. The IDE executes a compiler to create a binary executable from your code and then the IDE executes the binary. It does look like that you say that the IDE crashes. Not the binary, not the compiler, but the IDE. You have to tell more details.
#include <iostream>
#include <fstream>
#include <string>
usingnamespace std;
struct duomenys
{
string imones_pavadinimas;
int pelnas[4];
};
int main()
{
fstream duom ("duomenys.txt");
ofstream rez ("rezultatai.txt");
int sum = 0;
char pavadinimas[30];
duomenys A[4];
for (int i=0;i<4;i++)
{
duom.get(pavadinimas,30);
A[i].imones_pavadinimas = pavadinimas;
//cout<<A[i].imones_pavadinimas<<endl;
for (int k=0;k<4;k++)
{
duom >> A[k].pelnas[k];
//cout <<A[k].pelnas[k]<<" ";
sum = sum + A[k].pelnas[k];
}
duom.ignore(80,'\n');
rez <<A[i].imones_pavadinimas<<" "<<sum<<endl;
sum = 0;
}
Well, everytime I try to execute it (build and run) whole IDE stops working and crashes. It doesn't even show any errors in build messages.
P.S if needed I can translate the code to english