Skip to main content
caution

Note, this article is not finished! You can help by editing this doc page.

Using Replit.com

Replit is a very accessible online environment that allows you to create applications in C++. An important advantage is that it has an interactive console.

Creating an account​

For some time now, Replit.com has required the creation of a free account on their site. You can do this by following this link: https://replit.com/signup

Then complete the information below:

Creating a Replit account

Creating a project​

Once you are logged in, use the C++ application pattern we have prepared by going to this link:

Replit C++20 Project Template

Click Fork repl:

Creating a new project from template
note

You can also create a default C++ project that the Replit website offers, but at the moment only Clang 7 will be available, which does not support C++20.

Using the editor​

Once you have created your project, you will be transferred to the code editing mode:

C++ code editor

The main view is made up of three panels:

PanelContents
Lefttools view, by default file view 🗃
Middlecode editor ✏
Rightconsole 🖥 and system terminal (shell)

Running the program​

▶ At the top you will find the Run button that starts the application.

Run button

Before the program can be executed, its code must be compiled. This means that at the beginning you will see a command to compile the code in the console.

  • ✔ If the program code is correct, the line below will show the result of its operation.
  • ⚠ If the compiler detects any non-fatal problems on the code, it will warn you before running the program.
  • 🔴 If the code contains errors, the program will not be compiled or executed.
Compilation and running a valid code
🟡 Compile command, 🟣 Result

Editing the source code​

info

This section requires improvement. You can help by editing this doc page.

This environment supports all the basic functions that a beginner needs.

Code editor view

Keyboard shortcuts​

Replit is based on the same editor as Visual Studio Code, and therefore has similar keyboard shortcuts. In addition to the standard ones, it's worth testing these:

ShortcutDescription
Ctrl + Shift + P or F1Open a command window
Drag with middle mouse buttonPlace multiple cursors on adjacent lines
Alt + LPMAdd a new cursor at the click location
Ctrl + /Toggles comment on the selected fragment
Alt + 🔼Move the current line up one line
Alt + 🔽Move the current line down one line
Shift + Alt + 🔼Duplicates the selected lines upwards
Shift + Alt + 🔽Duplicates the selected lines downwards