Do you mean a second array that fills up with numbers as the loop progresses and then uses those numbers to name the variables? Like this
string[] arraynames = new string[2];...
Type: Posts; User: elsparko
Do you mean a second array that fills up with numbers as the loop progresses and then uses those numbers to name the variables? Like this
string[] arraynames = new string[2];...
I'm trying to create a loop that will create some variable as it goes through and then add the variables to an array. I want to name the variables created based on their position in the array,...
Hi again
one of my classes operations keeps throwing up errors saying it can't find data it should be able too.
the operation is AISnake::check_collision( ); and it is a friend of the food...
your right, it should be 'canvas' rather than 'Canvas'. thanks
the only problem is, it now can't find canvas :-S
going to have to figure out how to pass canvas along the functions to reach...
Hi again
Whenever I try and call the function of my food class I get the error
expected primary-expression before ')' token
heres the operation being called
food::draw_food(Canvas);
Hi again.
I want a operation in one of my classes (Snake) to be able to use the attributes of another class (food), so I want to declare that operation as a friend of food.
I'm still new and...
problem solved
I added default values to the position structure and now it works like a charm
thanks for all the help everybody
erm, ok
here's the header file for the food class
class food {
//Attributes
Well I changed the food constructor to this
food::food(int x = 0, int y = 0)
{
ImageFile("../Assets/node3.tga").load(foodImage_);
}
I'm still getting the same error, but...
Hi again.
I'm getting a strange compiler error that I just can't figure out how to fix.
the error reads
error: no matching function for call to ‘Position::Position()’
heres some of the...
Ok, I've done some reading, but now I'm not sure if iterators can even be used in an array.
All the examples I've read only use iterators with lists and vectors from the STL.
can they be used...
Ok, I've done away with the whole iterator thing and now I haev this
void food::draw(Canvas &canvas)
{
for (prog = foodpositions_[prog]; prog != foodpositions_[5];...
foodpositions_[ ]is an array of 5 structures that hold two ints.
its declared elsewhere in the code, heres a looky
//decleration of position
struct Position
{
Hi again,
I'm trying to set up some inheritance between some classes that I've already written.
There are two classes, Snake (parent class) and AISnake (derived class). here are their current...
Hi there
I'm having trouble with an iterator, I have used them very often so I'm not sure why i'm getting the error
heres my code
void food::draw(Canvas &canvas)
{
...
Ok, i've changed the code to what I think you wanted me too, the structure now looks like this.
struct Basecard
{
struct _persons //structure that holds the names
{
char...
Hi again.
I've got this program that's supposed to generate Christmas cards. it does this using hard coded information and information given by the user.
it uses the following stucture at its...
No, I haven't assigned x or y to anything in the .hpp file. I'm sorry I should probably have posted both the .hpp and .cpp versions on the constructor.
Although this was something I did earlier in...
I already had the header guards in when he told me to add them ;-)
anyway, heres the AISnake constrructor
AISnake::AISnake(int x = 0, int y = 0)
{
...
Thats exactly what my tutor told me, but I am using header guards.
I have the following guards in their respective files
#ifndef SNAKE_HPP_INCLUDED
#define SNAKE_HPP_INCLUDED
{code}
Hi there,
I'm writing a simple snake game for a uni course, and I'm having a little trouble linking all the files together
I have 3 classes (Snake, AISnake and GameEvent) and a structure...
hi there
I'm looking for a bit of semantics help. I know what I want to do, but don't know what its called so I can't really learn how to do it :P
I have four classes:
Snake
PlayerSnake...
*face palms* of course! I see it now, I knew it would be something simple/stupid
you'll have to forgive me, I'm not used to spotting these little errors yet, but I'm still learning.
Anyway,...
Anyone that's seen one of my previous posts over the past few days , most of that stuff has now been scrapped as I thought we needed to have an uninitialized array, but it turns out we don't.
...
thanks for the replies, since I'm new to C++ I wasn't sure if what I was thinking was something I could do.
what I was trying to show in the second pseudo block was a loop where the name of the...