#include <iostream>
#include <fstream>
#include <string>
int main() {
// Declare variables
std::ifstream inputFile;
std::string fileName, line;
// Get file name from user
std::cout << "Enter the name of the file: ";
std::cin >> fileName;
// Open the file
inputFile.open(fileName);
// Check if the file is successfully opened
if (!inputFile.is_open()) {
std::cerr << "Error opening file." << std::endl;
return 1;
}
// Read and display the contents of the file line by line
while (getline(inputFile, line)) {
std::cout << line << std::endl;
}
// Close the file
inputFile.close();
return 0;
}