A+ A-

General Structure of a Simple C++ Program

#include <iostream>
using namespace std;
int main() {
cout << "This is a simple C++ program!" << endl;
}


You can type the text into an editor and save it to a file named simple.cpp. The actual name of the file is irrelevant, but the name “simple” accurately describes the nature of this program. The extension .cpp is a common extension used for C++ source code. After creating this file with a text editor and compiling it, you can run the program. The program prints the message.



This is a simple C++ program!

vThe actual name of the file is irrelevant, but the name “simple” accurately describes the nature of this program. The extension .cpp is a common extension used for C++ source code. After creating this file with a text editor and compiling it, you can run the program. The program prints the message.