if (input == 'n' && NewUser.location->north)
NewUser.location = NewUser.location->north;
if (input == 's' && NewUser.location->south)
NewUser.location = NewUser.location->south;
if...
Type: Posts; User: Aliaks
if (input == 'n' && NewUser.location->north)
NewUser.location = NewUser.location->north;
if (input == 's' && NewUser.location->south)
NewUser.location = NewUser.location->south;
if...
Ok well I am none the wiser of what this does :(
I did not write this, I have come across it while brousing and don't understand it proparly
Hey guys, just wondering if anyone could give me an idea what this code does?
static int randBetween(int low, int high)
{
if (low == high) return low;
if (low > high)
{
...
virtual bool isCorrectAnswer(const std::string& answer) const = 0;
Im guessing that it is a overide-able yes or no which is decided later.
It checks if the value stored in answer is correct?
...
http://cboard.cprogramming.com/cplusplus-programming/117544-moving-between-areas.html
This is a link I had help in, maybe looking through that could help you out.
Yes I would say so,
I just wish to read the questiosn and answers from a text file
Not entire lines of words and then a number like with the above structure
I can only find stuff about saving out variables but not the rest, i tried googling but cant find anything useful.
Wondering if anyone knwos a book or a reference for this?
Ok thankyou, I keep forgetting the = x 2 gah.
Sorry I will be a bit more specific.
I have a question scruct which questions in it,
RiddleGenerator::QnA RiddleGenerator::mQnA[RiddleGenerator::QuestionCount] = {
{ "What shape as...
I know how to open and display a text file, just wondering if you can use the text from a terxt file to work for a struct,
eg.
Txt file
"blablabla" , 3
or
Just wondering if something like this,
if (NewUser.location = &rooms[1])
{
some function
}
Would fit into this,
Yep, I just figured that I needed a getline instead of the cin in between.
Thanks alot for your help, I can put all my elements together now I got that troublesome part out the way!
yeah I noticed that over the time I have been using c++, before I changed it to getline(cin,input) through out my program for example I had , Username, Age, Pet, This, That, as input for the user....
I believe it is something to do with the input, it does not ask for it and defaults to incorrect, hence not moving anywhere.
by doing it that way, when the user takes a direction, it does not move, it repeats the same room.
I think a issue I need to address is how the loop is structured. so that moving to the loacation is not a part of the else
while (true) {
// Display the players location and possible movements.
cout << "------------------" << endl;
cout << "Location: " << NewUser.location->name << endl;
cout <<...
Sorry I have not done structs yet, I will look into them.
RiddleGenerator::QnA RiddleGenerator::mQnA[RiddleGenerator::QuestionCount] = {
{ "What is your Quest?\n\t1)To seek the holy grail?\n\t2)Party Party Party", 1 },
{ "What is the best...
Hey Zlatko, thanks for the reply.
Yes I would like to randomly pick or generate some questions which I can slot into my moving around part.
Some of the questions would be math, spelling,...
Ok thank you for your response, I quite tired so I am not following what you are saying so I will take a look tomorrow.
This probably isnt the most effiencent but something like.
If the players location = this number (Room number)
then do this function
Something like that would work, would allow me to...
Yeah I tried that, but what about on large scale, if im moving between 50 rooms, that wouldnt work, because it would be move north if input is 12 for every single room