Apply space on the next line

Answered

My code should run as below: 

But in clion it is executed as follows:

did you see  When I add a space (spaces), instead of being applied to the current line, it is applied to the next line.

How do I solve this problem?

The text below is the code that I run.

#include <iostream>

int getNumbers(int num1, int num2) {

    return (num1 + num2) * (num1 - num2);

}

int main() {

    std::cout << "Hello, welcome to program\n";

    std::cout << "This program performs mathematical calculations on the inputs.\n\n";

    std::cout << "Enter two numbers (with space):          ";

    int num1 { 0 };

    int num2 { 0 };

    std::cin >> num1 >> num2;

    std::cout << "The numbers are: " << getNumbers(num1, num2) << '\n';

    return 0;

}

0
1 comment

Hello!
 
If you use a MinGW or MSVC toolchain, then you face CPP-17579. Feel free to comment or upvote the issue in order to get updates. See https://intellij-support.jetbrains.com/hc/en-us/articles/207241135-How-to-follow-YouTrack-issues-and-receive-notifications if you are not familiar with YouTrack.
 
You can use the Emulate terminal in the output console option as a workaround (https://www.jetbrains.com/help/clion/terminal-in-the-output-console.html) or other workarounds described in CPP-17579.

0

Please sign in to leave a comment.