Question
#include #include #include #include #include #include using namespace std; int main(int argc, char* argv[]) { char* filename; char name[100]; if (argc >= 2)filename = argv[1];
#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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started