Question: This is a C++ Program, I want to understand what it exactly does, line by line. #include #include using namespace std; int main() { ifstream
This is a C++ Program, I want to understand what it exactly does, line by line. #include#include using namespace std; int main() { ifstream fin; fin.open("my-input-file.txt", ios::in); char my_character ; int number_of_lines = 0; while (!fin.eof() ) { fin.get(my_character); cout << my_character; if (my_character == ' '){ ++number_of_lines; } } cout << "NUMBER OF LINES: " << number_of_lines << endl; }
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
