My question is about the isalpha() statement. I know that the islpha is to check if it is a char but, i get errors in the for loop. How can i resolve this problem any guidance will help. Thanks in advance.
#include <iostream>
#include <fstream>
#include <string>
usingnamespace std;
int main()
{
string line;
ifstream inputfile;
inputfile.open("text.txt");
if (inputfile.is_open())
{
cout << "the file is open safely and it reads this\n\n" << endl;
cout << line << endl;
cout << "\n\n" << endl;
while (getline(inputfile,line))
{
cout << "After the changes from the file it reads this" << endl;
for (int i = line.begin(); i < line.end(); i++)
{
if (islower(toupper(line)))
{
cout << line << endl;
}
if (isdigit(line))
{
cout << "the numbers in the file are " << line << endl;
}
}
}
inputfile.close();
}
else
cout << "Error file could not be read " << endl;
system("pause");
return 0;
}