I started reading up on C++ yesterday, and I am a person who learns best by doing rather than just reading theory, so I wanted to create a small game where you are presented with dialogue, and thereafter have 3 options which each will lead you to another piece of dialogue, and thereby create an adventure for yourself that way.
I came across an RPS game which I modified as practice. It turned out like this:
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main()
{
int choice;
cout << "The number adventure!.";
cout << " Type 0 for 0.";
cout << " Type 1 for 1";
cout << " Type 2 for 2";
cin >> choice;
// Option 0
if (choice == 0)
{
cout << "You chose 0";
}
// Option 1
if (choice == 1)
{
cout << "You chose 1";
}
// Option 2
if (choice == 2)
{
cout << "You chose 2!";
}
return main();
}
Which works how I wanted in theory. I just can't figure out how to expand the dialogue options, so they each lead to three new, unique dialogue options and keep the ball rolling from there. So if anybody would be so kind to forward me in the right direction.
And please don't tell me to read up more theory, until I get a good enough understanding of C++ so that I can figure it out myself. I like toying with stuff like this to supplement my reading. And looking at working code while trying to figure out how everything plays together is something I enjoy, and I learn a lot from it in my experience.
So thank you if anybody wants to help me.