This is the beginning of the code i have and it keeps returning the "cannot open file" and i cannot see why...
Code:
#include <fstream>
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <math.h>
using namespace std;
#define MAXD 100
ifstream in_file;
ofstream out_file;
void read_input(int& NJ, double COORD[MAXD][2], int& NS, int MSUP[MAXD][3], int& NMP, double EM[MAXD], int& NC, double CP[MAXD], int& NM, double MPRP[MAXD][4], int& NLJ, int JP[MAXD], double PJ[MAXD][2]);
void Struct_Stiffness(double KL[4][4], double L, double E, double A, double C, double S);
int main()
{
int NJ, NS, NMP, NC, NM, NLJ;
double COORD[MAXD][2]={0};
int MSUP[MAXD][3]={0};
double EM[MAXD]={0};
double CP[MAXD]={0};
double MPRP[MAXD][4]={0};
int JP[MAXD]={0};
double PJ[MAXD][2]={0};
double Stiff[MAXD][MAXD]={0};
int NP[4];
int el=0;
int i, j;
in_file.open("input.txt");
out_file.open("output.txt");
if(in_file.fail())
{
cout << "The file cannot be opened." << endl;
exit(1);
}
read_input(NJ, COORD, NS, MSUP, NMP, EM, NC, CP, NM, MPRP, NLJ, JP, PJ);
..................
Last edited by a moderator: