C++ Basics : A skeleton program

The program below is a simple skeleton that you can use as a starting point for your own programs. See the C++ Simple Program tutorial for a detailed explanation of each line.

  1. Create a new empty C++ console project
  2. Add a cpp source code file
  3. Copy and paste the code below into the empty source code window.

C++ program skeleton

// Include the input/output stream library

#include <iostream>  

// Indicate that commands are being used from the std namespace

using namespace std;  

// Begin the main function, specifying that
// there is an integer as the output but no inputs

int main(void){  

 

// WRITE YOUR CODE HERE!

 

// Use the system command PAUSE to ask the user to press a key

system("PAUSE");
 

// Use the special code EXIT_SUCCESS as the return
// value for the main function. This means everything went OK.

return EXIT_SUCCESS;
 

} // End the main function