There's no way I can make a border of characters around the whole screen. After hours of just tampering, I've given up on hope that a cout and cin can go on the same line. It seems like it should be really simple to this since games back then were just like this but is there any simple solution to this problem?
What you are trying to do is impossible with standard C++. Your program will just output one character after another, and there is no way to go back up a few lines.
If you really want to make it work you can use a library such as ncurses on Linux, or the WinAPI on Windows, but that's a bit more advanced.
from line 12 to 28 you could have a single cout.
What I am saying is that cin streams data from the console to the user , cout streams data from the user to the console. If you want to do like an interface , note that you will have to use coordinate I think of the function gotoxy and flush the console as well.
It seems like it should be really simple to this since games back then
It wasn't "really simple" back then either.
The thing is that there are no screens nor windows as far C++ is concerned. There is OS (which might be implemented with C++, but that is irrelevant). A regular C++ application can call the API of the OS. The OS in turn has means to do something with the monitor. There are usually a chain of components rather than "OS".
Games "back then" did use the OS, or did by-pass the OS and did the hard work themselves. If the game did not have code for device Y, the game could not use Y. The OS has code for many devices, so games don't need to care what the computer has. One API works more or less the same with all devices. Modern OS do not allow by-pass (it is a security issue).
Different OS have different API and the function calls can be complex. A library like ncurses is an another layer of simplification. It offers API to do the type of operations that you "easily". There are also versions of ncurses for multiple OS, so the application does not need to know the OS.
I could have a single cout Ericool, but that'd be way too hard to follow. That window was long enough with borders. Anyway so having a cout statement after a cin appear on the same visible line is impossible? Thanks for all the input, I might need to use some of these tips later on. I'll post if my professor had a solution or other way of doing this.
so having a cout statement after a cin appear on the same visible line is impossible?
You can use cout to output what comes before cin but when it reaches the cin statement it stops and waits for the user input so the right border on that line and everything below will not be outputted yet.
Panda187 wrote:
I could have a single cout Ericool, but that'd be way too hard to follow.
Just because you use a single cout statement doesn't mean you can't put it on multiple lines. This doesn't really have any real advantage though, except it repeat the cout keyword less times.
Panda187 wrote:
That window was long enough with borders.
If you have learned about loops, you could use a loop to output the top and bottom border instead of repeating << loop so many times.