Here is my task. I want to read in from a file a set of numbers, but I need to read them in as CHARS. I then need to convert each one to INTS. Each character will be stored in an array and then will be added together. The problem I am having is it seems that I keep reading in the '\n' and I dont want that. Here is my code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
char char1;
int num1 = 0;
int i = 0;
while (char1 != '\n')
{
inFile.get(char1);
num1 = char1 - '0';
arr1[i] = num1;
cout << arr1[i];
i++;
}
}