The goal is to print a array w/either "1" , nothing " ", but I'm trying to make it into and If statement so it will do one or the other not both......becuase regardless of what the file says is always prints the array w/1's and spaces even when the file is all 2's or all 1's or nothing :?
So I'm kind of lost and yes this was intended as a part of my turtle assignment thing, but more as a test to see if i could get the 2d array to actually work and well I'm not having success
Code:#include <cstdlib> #include <iostream> #include <fstream> #include <iomanip> using namespace std; const int SIZE = 30; const int SIZE2 = 30; void checkPen(int); void checkPen2(int); int main() { ifstream infile; int fileInput[SIZE][SIZE2], position; infile.open("turtle.dat"); infile >> fileInput[SIZE][SIZE2]; for (int i =0; i < SIZE; i++){ for(int j =0; j < SIZE2; j++){ if (fileInput[SIZE][SIZE2] = 1){ checkPen(position); } if (fileInput[SIZE][SIZE2] = 2){ checkPen2(position); } } } system("PAUSE"); return EXIT_SUCCESS; } void checkPen(int position){ cout << "1"; } void checkPen2(int position){ cout << " "; }