This is the same code you posted here:
http://www.cplusplus.com/forum/general/83638/
It still has exactly the same problems that I pointed out to you in that thread.
Problem 1 (lines 23-33):
1 2 3 4 5 6 7 8 9 10 11
|
string inFilename;
cin >> inFilename;
ifstream inFile;
inFile.open(inFilename.c_str());
if(inFile.fail()) //file does not exist
{
cout << inFilename << " does not exist. Please check it is in the appropriate folder.\n";
}
|
Why are you opening inFile? You're not using it. This code should be removed.
Problem 2 (lines 41, 46):
Learn the difference between an assignment operator and the equality operator.
That statement assigns the value of row to i. The result of the if will always be true.
What you want is to test for equality.
Problem 3 (lines 42 & 47):
|
cout << i = 1 && i = n << " * "<< endl;
|
What is that line supposed to do? It makes no sense. As best I can tell, you assigning 1 to i, then assigning n to i, then logically anding the two assignments and outputting a boolean values.