I'm really struggling in this class and just need help completing this code project. I don't completely get what is wrong with it. Can someone please help. It would be greatly appreciated.
int main ();
{
const char TAG = '<', //represents the beginning of a tag
LINK = 'a', //represents the beginning of a link
COMMENT = '!'; //represents the beginning of a comment
char fileChar; //individual characters from the file
int totalChars = 0, //total characters in the file
totalTags = 0, //total tags in the file
totalLinks = 0, //total links in the file
totalComments = 0; //total comments in the file
string fileName; //the filename that is input from the user
ifstream inFile;
cout << "Enter a valid filename (no blanks!): "; //ask the user to input filename
cin >> fileName; //user inputs the filename
inFile.open (fileName.c_str()); //the file is opened
while (!inFile) //if filename is not valid
{
inFile.clear(); //then clear the file
cout << endl << "Re-enter a valid filename: " << endl; //and ask the user to reenter a valid filename
cin >> fileName; //user inputs new filename
inFile.open (fileName.c_str()); //open file if filename is valid
}
cout << "========================================" << endl; //print header for the text of the file
cout << "Text of the File";
cout << "========================================" << endl;
inFile.get(fileChar); //get individual characters from the file
cout << fileChar; //display the individual character on the screen
while(inFile) //while the file is open
{
getline(inFile, line); //get each line from the file
cout << line << endl; //and print the lines on the screen
totalLines++;
}
cout << "========================================" << endl; //print the end of text message
cout << "End of the Text" << endl;
cout << "========================================" << endl << endl << endl;