input_line[0] is the first character in the array. It does not refer to the array's size.
If the value of input_line[0] is equal to "0", then your user is inputting "0".
Type: Posts; User: DarkAlex
input_line[0] is the first character in the array. It does not refer to the array's size.
If the value of input_line[0] is equal to "0", then your user is inputting "0".
Oh. That makes sense.
I guess I was thinking that I was using it as an argument.
Now that I'm calling the function correctly, the code complies.
Thanks for your help.
I am attempting to inline a member function as an argument of an equation.
Player.hitper=((d10.roll-1)*10)+(d10.roll-1);
d10 is a object of the class dice.
The class to which the function...
Thanks! It works now. I probably should have thought of that before.
Oh, right, forgot to post the error message I got.
I'm having trouble with sending NULL as an argument for a pointer. The functions and calls are as follows:
void room::build_connections(room* uparg, room* downarg, room* northarg, room*...
The 'bow' is currently a bool, but I intend to actually turn it into a legit 'weapons' object.
I've gotten a suggestion to place the classes and class properties into their own header files and...
Player is an object of a class I call character, which inherits from a class lifeform.
This is the code for all lifeform and all classes that inherit from it.
class lifeform
{
public:
...
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string.h>
#include <fstream>
Those are the header files I'm including, and similar file operation programs compiled without...
Ok, that fixed the load error, and replaced it with:
followed by a really long incomprehensible function name.
In a program that I'm working on, I'm having problems with the 'save' and 'load' functions.
Save:
int save()
{
string filename;
do
{
Ok. Thanks for the help, and for clearing up the terms. I'l be sure to use the term 'containment' to describe this situation from now on.
First, declare something like this:
double value, postotal, negtotal;
Then the end of the loop should check for negativity like this: If it's greater than 0, add value to postotal, else add value...
According to my C++ book, the following is legal:
class a_class
{
public:
int one;
int two;
};
Thank you for your help with fixing my coding style. The problems I had with my program were that I had not set a value for maxdef for either character, and the load error was because I forgot to...
A text-based game I'm working on is having several bugs I can't find. The battle system crashes the game if the user inputs the command to "block" or after a few commands and the load method fails...
I don't know if this is the right solution, but try this instead of cin:
getline( cin, students);
I had problems with just standard cin as well, but my problem was that the input was only one...
Yep, I do have to admit that. I also noticed that I had made this error in other areas of the program that would not have been good there. I also noticed that I had used == instead of = in three...
That fixed it, thank you. That makes me feel stupid.
I intended for all input to be in lowercase. This code worked until recently, and both places where it was placed stopped working.
EDIT: I'm pretty sure I didn't change the check to lowercase, as...
It's code I got off of a question I asked a couple of months ago. http://cboard.cprogramming.com/showthread.php?t=106347
It was to equate any input beginning with 'y' to 'y'. The code didn't act...
I'm having trouble with two nearly identical blocks of code in my program:
do
{
cout<<"What is your charater's name?\n";
cin.ignore();
getline( cin,...
The first game I ever finished completely, RockPaperScissors with sound! Not very good, but an upgraded version will appear in DarkRPG, eventually.
An upgraded version of the second game I made,...
Thanks. That fixed it.
This is the code where I tested the new input statement:
int play()
{
bool ok=false;
beaten=0;
hp=10;