For example, suppose you create an exe file with such contents in C ++.
#include <iostream>
using namespace std;
int main(){
int A,B;
cout << "Please enter A"
cin >> A;
cout << "Please enter B"
cin >> B;
cout << A+B;
}
It is a very simple program that adds two numbers entered.
When this is executed by python subprocess, it works as follows.
??????
Nothing is displayed ... What is this ...
So, nothing is displayed, but try entering 10 and 20. Then,
$ 10
$ 20
$Please enter A Please enter B 30
Wow. If something I wanted to display at the very end is displayed.
This has to be solved in C ++. ** A line break is always required on each line of standard output. Otherwise subprocess will not recognize the output. ** **
So
#include <iostream>
using namespace std;
int main(){
int A,B;
cout << "Please enter A\n"
cin >> A;
cout << "Please enter B\n"
cin >> B;
cout << A+B << "\n";
}
This is the solution.