Hey guys, what i'm basically trying to do in this
code is to write an array which is automatically written to a txt file in the order I have shown below, however, I not only get this error
--------------------Configuration: testmtl - Win32 Debug--------------------
Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/testmtl.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
testmtl.exe - 2 error(s), 0 warning(s)
But I also can not get any output on the file, I can sometimes get it to cout the values which are correct but can not get it to output to a text file, please help me to fix this!!!
Kind regards,
Zane.
#include <iostream>
#include <fstream>
#include <cmath>
using namespace std;
int main()
{
int ne = 10; //change
int nn;
int j = 1;
int k = 1;
int i = 1;
ofstream out;
out.open("input_matlab_array.txt");
nn = ne + 1;
int array1[11]; //change
int array2[11]; //change
int array3[11]; //change (number of nodes per line)
while (i <= nn)
{
array1[i]= k;
k++;
i++;
};
i = 1;
while (i <= nn)
{
array2[i]= k;
k++;
i++;
};
i = 1;
while (i <= nn)
{
array3[i]= k;
k++;
i++;
};
i = 1;
while (i <= ne)
{
out << i << " " << array1[i] << " " << array2[i] << " " << array2[i+1] << " " << array1[i+1] << endl;
i++;
};
i = 1;
while (i <= ne)
{
out << i << " " << array2[i] << " " << array3[i] << " " << array3[i+1] << " " << array2[i+1] << endl;
i++;
};
out.close();
return 0;
};