Design and program code that reads C/C++ program file (Text file) and seperate the comments into another file?
I can read from text file but I'm not understanding how to separate comments into another file
#include<iostream>
#include<fstream>
using namespace std;
int main() {
 ifstream myReadFile;
 myReadFile.open("text.txt");
 char output[100];
 if (myReadFile.is_open()) {
 while (!myReadFile.eof()) {
    myReadFile >> output;
    cout<<output;
 }
}
myReadFile.close();
return 0;
}
 
    