So I have been looking into c++ a bit now, been very interested in programming for years and have friends with limited experience.
I started learning the basics yesterday (I already had good basic knowledge of what programming is and how programming languages work, and I know how variables etc work so I feel I have a good base knowledge to start learning) I already got down the "hello world" and how to create variables with integers and make simple messages, I also have learned how to make loop codes like:
#include <iostream>
usingnamespace std;
void main()
{
int svar;
cout << "Type in a number from 1-3 for a response. Type 0 to exit." <<endl;
cin >> svar;
while( svar != 0 )
{
if ( svar == 1 )
{
cout << "Lol noob" << endl;
}
elseif( svar == 2 )
{
cout << "kek bur" << endl;
}
elseif ( svar == 3 )
{
cout << "Ouch" << endl;
}
elseif( svar > 3 )
{
cout << "You must type a number between 1 and 3" << endl;
}
cout << "Type another number: ";
cin >> svar;
}
}
Now I wanted to make something a bit more complex, but this is where my friends knowledge ran out and I have been searching the internet for this for hours now (also how I haply ran into these forums)
So here is what I want to make:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
You get a start up text that says something, lets say:
"Welcome to this message, please type y to continue or n to close this program"
the user presses y and the next message pops up and the old one is removed
"You have chosen to move on in the message, would you like to continue y/n"
The user presses y to continue or n to close the program
"This is the next message, would you like to continue y/n"
etc etc
and then eventually I want to learn how to make the messages branch out with multiple choices but I figured this was a good start, any comments are greatly appreciated on how I can get this done !
Unfortunately, the console is not really meant to do things like clear itself, print on specific lines, etc. If you really want to do that, you could look into the ncurses library.
Otherwise, I would suggest just doing it without clearing the screen...btw if you need a good tutorial, this site has quite a nice one: http://www.cplusplus.com/doc/tutorial/