Why if I input EOF from keyboard Clion don't print on Run window the output of the program?

已回答

I just start to using Clion as my IDE and I'm struggling with EOF inputed from keyboard.
If I execute this simple c++ code

 

#include <iostream>

int main(){
int sum = 0, value = 0;
//read until EOF, calculating a running total of all values read
while(std::cin >> value){
sum += value;
}
std::cout << "Sum is " << sum << std::endl;
return 0;
}
In the Run window of Clion, after I input from keyboard
`1 2 cmd+d` I get this

1 2 ^D

Process finished with exit code 0

 

Platform: MacOS

0

There is a bug in CLion: https://youtrack.jetbrains.com/issue/CPP-5704. Feel free to comment or upvote and sorry for the inconvenience.

0

请先登录再写评论。