I am tring to read contents from a file and pass it into array. Then take that array and put it into another array. Next read those values back out to an oupt stream. My code is below. However, I am getting subscript errors. What is wrong? Also, my input file contains float values.
Code:int main () { //Declare Variables ifstream inFile; //input stream ofstream outFile; //Output stream int increm=0; //index for input stream float array[5]; inFile.open("test.txt"); outFile.open("tester.txt"); while (!inFile.eof()) { inFile >> array[increm]; //Read contents of file cout<<array[increm]; for(int temp= 0; temp <= array[increm];temp++) of for(int i=0; i= temp; i++) { array[increm] =temp[i]; cout<< temp[i]; outFile>> tester.txt; } increm++; //increment index } inFile.close();//close output stream outFile.close();