0

Various Code Files

Hello pro-grammers 🙂 In this codeplayground, is it possible to post codes that contain various files, like some header in cpp? Cheers ✌️

12th Feb 2019, 9:30 PM
Maximilian Spall
Maximilian Spall - avatar
1 Answer
0
Hey! 🙂 In SoloLearn Code Playground, you’re limited to writing code in a single file per project — so multi-file projects (like C++ code with separate header files and .cpp files) aren’t natively supported. But there’s a workaround: You can simulate header files by writing your “header” code at the top of the file, like this: // myheader.h (simulated) #ifndef MYHEADER_H #define MYHEADER_H void greet(); #endif // myheader.cpp (simulated) #include <iostream> void greet() { std::cout << "Hello from the header!" << std::endl; } // main.cpp int main() { greet(); return 0; } Just put everything in one file, and comment which part represents which file — it works and is readable! Cheers ✌️ and happy coding!
16th Apr 2025, 4:15 PM
Ebrahim Hany
Ebrahim Hany - avatar