skip headers while reading text

#include <iostream>
#include <fstream>
#include <string>

int main() {
    std::ifstream inputFile("input.txt"); // Open the input file stream

    if (!inputFile.is_open()) {
        std::cerr << "Error opening file." << std::endl;
        return 1;
    }

    std::string line;

    while (std::getline(inputFile, line)) {
        if (line.empty() || line[0] == '#') {
            continue; // Skip empty lines and lines starting with '#' (comment)
        }

        std::cout << line << std::endl; // Output the non-empty, non-comment lines
    }

    inputFile.close(); // Close the input file stream

    return 0;
}