Jump to content


Felthorn

Member Since 24 Dec 2012
Offline Last Active Feb 17 2013 06:53 PM
-----

Topics I've Started

Question on Do\While

15 February 2013 - 12:15 AM

Hey, I have a (probably really stupid and noobish ) question. Do I need to have a condition for a do\while statment. I've change my game so that it is far simpler, and right now I'm trying to make a room with two doors in it, and I want the game to ask you which door you want to use every time you enter the main room. Any help will be greatly appreciated. Thanks! :)

Game Help

24 December 2012 - 05:43 AM

Hi all, I need a hand with some code for a text based game. I have loved video games for most of my life and I thought maybe I could make one my self but hit a snag. I need a back function to go back a step in my game. For example if the game asks you if you want to make your own character or use a pre made character and you choose to make your own character. Then the game asks you is this your choice and you say nah I'll use a pre made character, that's where my problem is. It will not show the pre made character things and so I rewrote the code to this:


#include <iostream>
#include "back.h"
using namespace std;

int yesno (int min, int max)
{
int choice1;
do
{
cout << "Please enter one of the above numbers.\n";
cin >> choice1;
cout << endl;
}
while( choice1 < min || choice1 > max);

return( choice1 );
}

void back ()
{
int choice1, i;
char *back[3] = {"Is this your choice?", "1: Yes", "2: No"};
for (i = 0; i < 3; i++)
cout << back[i] << endl;

choice1 = yesno (1, 2);

if (choice1 == 1)
while () {continue};

if (choice1 == 2)
do
{
begin ();

choice = getchoice (1, 2);
cout << endl;
}
while(choice1 == 2);

return (choice1);
}

but it will not work either. Please help anyone. Thanks!:)