Question: Please review this code. #include #include #include #include #include #include using namespace std; int main(int argc, char* argv[]) { char* filename; char name[100]; if (argc
Please review this code.
#include
using namespace std; int main(int argc, char* argv[]) { char* filename; char name[100]; if (argc >= 2)filename = argv[1]; else { cout << "Enter file name you want to read "; cin >> name; filename = name; ifstream fin(filename); }
//open file for reading ifstream fin(filename); if (fin.fail()) { cerr<< "File cannot be opened: "<< filename< } This is the code, when I try to read from file its not working for example take input file as 3456 Georgre 10.25 1234 smith 4.5 4321 staci 12.75 278 sandra 25.35 The output for this file should be : LINES: 4 WORDS: 12 CHARS: 75 DIGITS: 29 LETTERS: 21 But instead its reading directly from the file. PLease edit this code for me.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
