Terminal Functions to Use
In C#, we had picked up a number of methods that we could use to achieve different results. The good thing is that all the SplashKit methods are available as C++ functions or procedures. In this section we can quickly look over the declarations of the C/C++ terminal and multimedia functions and procedures that you may want to use.
The following declarations provide the functions and procedures you use to interact with the user via the terminal. These match with the C# methods WriteLine
, Write
, and ReadLine
.
There are also the data type testing and conversion functions you will need to convert data to and from strings.
The to_string
function is something new that we will have to get used to using. In C#, you would have used string interpolation (eg. $"Hello {name} you are {age}"
) to embed data within strings. In C++, you need to do this by adding strings together. You can’t do "you are " + age
if age is a number, instead you have to do "you are " + to_string(age)
so that you are adding strings together.
Example Terminal Program
You can use these as shown below: