These tend to be more or less difficult aspects of Windows API, involving manual mapping, disassembly and such.
The logic is the key here, normally when a console calls any std:: members, it will mostly result in some type of memory storage of these calls especially the stdin calls.
Therefore you may need to create some level of pattern signature in the process then you need to locate the variable which stores the data of the input, then once located a simple call to ReadProcessMemory or NtReadVirtualMemory would successfully return to you information. As for writing you may simply call WriteProcessMemory or NtWriteVirtualMemory. This would involve creating custom disassemblers and debuggers, which is too much work for these sort of petty programs.
As for Window based UI reading and writing, it is much more simpler as you may need to perform a simple code injection into the process then use SendMessageA to gain the text box values. I would highly recommend you should use Window based UI for these sort of things.
If the following applications are part of YOUR project and NOT 3rd Party, you can use IPCs to communicate with each other. This would be 100x more easier than the above steps suggests.
A simpler way might be just to use "GetStartupInfo()" to retrieve a STARTUPINFO struct which would contain that handles to hStdInput and hStdOutput. You can write to hStdInput using "WriteFile()" and read from hStdOutput using "ReadFile()".