Is it possible to have code in a .txt?

Hi, I am currently working on a group project and we have made this code to compare codes to see if their similar. Well I was wondering if it was possible to use a .txt file to put the code in so that the program can read it and use it.
You do not even need it to say ".txt". A code file is just a text file, so you can just open it and read it as such.
So if we save it under the .txt, it should still work?
Save it as .h (header) or .cpp - use one of the extensions that the toolchain understands by default.
You might get problems with some tools because the file extension is often used to decide what kind of file it is. You might have to change some settings / pass additional flags in order to compile your code correctly.

But why can't your program handle text files with any file extension? Why does the filename has to end with .txt? I think instead of renaming your code files a better solution is fixing your program (if it needs to be fixed) so that it doesn't care about file extensions.
@Peter87 My partner made up the main code and he included program1.txt and program2.txt They have to contain the code that I am going to come up with so that the program that he made can compare the two codes in program 1 and 2 to see if they are similar or not.
Topic archived. No new replies allowed.