In order to write code, it is recommended to use a program specifically made for coding. An IDE is any program that code can be written on. IDE stands for Integrated Development Environment. An ideal IDE would include features such as a syntax-highlighter, a compiler, and a debugger.

Below are two IDEs that are made for writing C++:

  • Code::Blocks (recommended)

    • Code::Blocks works best for smaller programs and files (such as files submitted for contests)

    • Can work for Windows, Linux, and Mac

    • Download Link

      • When using Windows, install the Code::Blocks-16.01mingw-setup.exe

  • Visual Studio

    • Visual Studio works best for larger projects

    • Requires Microsoft account

    • Download Link

This doc will walk through the usage of Code::Blocks.

Setting up Code::Blocks

If Code::Blocks is running on Mac OS, the program will urge that command line must be downloaded. Allow Code::Blocks to install command line.

Once Code::Blocks finishes installing, click Settings on the top task bar, then click compiler…​

image

On the Global compiler settings tab, ensure that GNU GCC Compiler is the selected compiler. If the program is complaining that it cannot find that compiler, click on Reset defaults.

If Code::Blocks still complains, Google is your friend! Welcome to Markville’s Computer Science Course :D.

Setting up a C++ File

To create a new C++ file, click on File on the top left corner of the window.

  • Select File > New > Empty File

image

Pressing Ctrl-S or going to File > Save will save your code. When saving, ensure that the file name of your code ends with .cpp and not .c. The extension defines whether the document is a C file or a C++ file. A lot of material in this course cannot be used in a C file.

image

Pressing F2 or going to View > Logs will display an extra window on the screen. This screen will be important for debugging code.

On the empty file, there should be line numbers shown on the left. If the line numbers do not show for some reason, go to Settings > Editor > Other editor settings and check the box with Show line numbers beside it.

In Summary:

  • An IDE is a program that allows users to write and execute code

  • Visual Studio and Code::Blocks are common IDEs