ahh, okay, thx.
Type: Posts; User: Cris987
ahh, okay, thx.
I made a class called Box, which has a size of 100 . Then I made an array of 6 "Boxes" , now, the size if 600. However, when I pass this array into a function, and tries to use sizeof in the...
I think it's a simple syntax error, but I can't seem to fix it.
#include <iostream>
using namespace std;
class Town
{
public:
Town(string Name): name(Name) {} ...
OMFG....thx alot
Okya, I 'm gonna post up the actual code that makes the error
//TOWN.H
#ifndef TOWN_H
#define TOWN_H
#include <string>
#include <iostream>
using namespace std;
Umm....tried it. Stilll doesn't work (same error) :(
well, ya....sry, but that wasn't the problem (i just typed it wrong)
here's my simplified codes:
class Drug
{
public:
Drug(): avai(0) {};
bool& get_avai()
{
...
I got wat u guys were saying. Thx! :D
okay, i think i understand now. But here's one more question: when returning the value of a variable in a class using a function, which one below is better?
int returnsomething(int member)
{
...
Would you mind giving me a small example on "functions that return variables you don't want changed"? :rolleyes:
I'm getting confused with the two. When should I use protected and when should I not? My book says almost all the variables in a class should be protected, yet I found that really cumbersome when...
thx alot, i fixed everything! :D
umm...anyone out there? :rolleyes:
i did wat u told me, but the following errors still occur
-town.cpp In constructor `Town::Town()':
-line 14 town.cpp no matching function for call to `Drug::Drug()'
-line 8 town.h candidates...
kk, didn't have time in the morning, so didn't read thoroughly ><
I use Dev C++, Windows XP . And here are the codes and errors:
//town.h
#ifndef TOWN_H
#define TOWN_H
#include <string>...
well, I was on gamedev the other day, and saw a person get blast at for posting half a page of codes. He was advised to post up a zip file instead. so - ya. anyways, here's the code that has the...
All the errors r in the file town.cpp .
The errors:
- In construtor Town::Town()
- no matching function to call Drug::Drug()
-candidates are: Drug:Drug(const Drug&)
...
I 'm trying to write an ASCII clone of DopeWars, but had just gotten a bit of a break through, when I found out there's a whole bunch of errors when compiling. Would somoene(s) please tell me wat i...
Well, at least he/she is better than MY teacher. Who goes: "Sup gurls, need some help? " (and simply type up the whole program for the gurls) ; and " HEY, YOU GUYS, wat r u doing on the internet?...
Okay, first of all, there's a few problems with your code:
1. prototypes should have ';' at the end
2. it's cout << 1 << 2 << 3 << 4 not cout << 4 << 3 << 2 << 1
The code works perfectly fine...
I found this book online at my local library: Windows programming with C++ Henning Hansen. Has anyone read it? Is it any good?
wups ! that's true. But the same errors is still there....
Do you mean that I need the ';' for my constructors and destructors? I tried that, but nothing changed.
-------------------------------------------------------------------------------
//integer.h
#ifndef INTEGER_H
#define INTEGER_H
#include <iostream>
class Integer
{
private: