CLion 120 characters wrap in terminal Windows

  c++, clion, g++, mingw

The code below is a simple program with really no other utility than to demonstrate the problem I have with CLion with g++ and mingw for Windows (Mingw-w64 g++ 11.2.0).

    #include <cstdlib>
    #include <iostream>
    
    using namespace std;
    
    int main() {
       int a;
       cout << "Please choose a first number (between 1 and 100) :";
       cin >> a;

       cout << "Please choose a first number (between 1 and 100) :";
       cin >> a;

       cout << "Please choose a first number (between 1 and 100) :";
       cin >> a;
    
       return EXIT_SUCCESS;
    }

This code should’ve looked like this :

Please choose a first number (between 1 and 100) :1
Please choose a first number (between 1 and 100) :2
Please choose a first number (between 1 and 100) :10

But what I’ve got is this :

Please choose a first number (between 1 and 100) :1
Please choose a first number (between 1 and 100) :2
Please choose a firs
t number (between 1 and 100) :10

What I’ve read so far was that the terminal was wrapped at 120 characters. But if I really want to keep this look (no endl after each text and no endl after each cin), I can’t think of a solution. I already know that I can change the limit of my terminal for the character wrap (https://stackoverflow.com/a/52290166) but that would only postpone the problem because if I want to ask for 30 numbers the limit I have to set is too big.
And the "Soft wrap" button didn’t change anything whether it’s activated or not.

If you think of any workaround for this issue I would be really grateful. Thanks ;D

Source: Windows Questions C++

LEAVE A COMMENT