Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

nosibar: acceptable code tags are [code=cplusplus] ... [/code]

The way to call base class from derived

void DERIVED::Method()
{
     BASE::Method();  // call Method() is base class.
}

Note that its not necessary to pass the this pointer because that is passed by default.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You can read about my reasons here. Browse around the other archive articles and you will find many other members and their reasons.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

NodeType is a structure and you have not declared a constructor for it. Fix it like this:

struct NodeType
{
	ItemType info ;
	NodeType* next ;
    NodeType(ItemType t) {info = t; next = NULL;}
    NodeType() {info = 0; next = NULL;}
};
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

again you have to post the class declaration. But my guess from that error message is that the parameter in the function prototype is not the same as in the function implementation. But the only way to tell is for you to post the class.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

sizeof( colour ) probably isn't going to work. The sizeof( ) operator only gives the size of the array in the function where the array was declared. All you are likely to get here is the size of a pointer.

.

I was assuming colour was a character array, not a pointer. But if it is a pointer then of course you are right and the op needs to pass an integer constant that indicates the max size.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Could someone tell me what I'm doing wrong?
No because you need to post the class and the error message(s)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

after changing the header file did you re-compile everything?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

did you try #include <mysql/mysql.h>

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Did you install mysql database on your computer? If no then I think you may have to install mysql on your computer in order to get the header files etc.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you probably don't need to see an expensive head shrink. And many married people also go around violating every rule of their religion -- assuming they have a religion.

Married people don't hate single people, many married people are jealous because they'd like to be single again. But that's their problem, not yours.

nav33n commented: Ah! Now thats the truth! ;) +10
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The error message has not changed. It appears you did not change it correctly, there may be more than one occurrence of the prototype, or there may be multiple copies of the header file.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>it seems that sometimes married people don't really like us , to contribute with us or to work together with the single people ?

Nonsense. I have been married all my adult life and worked around single people many many times. True, we do not socialize often with signgle people because we have our own families (wife and children) and married people just don't normally have the same kind of social life that single people do (such as dating).

But at work I have rarely, if ever, seen problems with single and married coworkers. What ever problems you preceive are just in your head.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

for linux just change c:\blabla to whatever it is on your computer.

>>When I did locate mysql.h , its not in my system
you mean its on another mounted file system? That should be ok, You will also have to do similar for the mysql libraries so that your compiler can link to them.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The first function is recursive, while the second is not. For the second function to work you need other code to call it repetedly.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

it was almost there

int main()
{
    char* text = "scr*w?d";
    char* sig = "screeeewywxd";
    int i = 0;
    int j = 0;
    for(i = j = 0; text[i] && sig[j]; ++i )
    {
        if( text[i] == '*')
        {
            while( sig[j] && (sig[j] != text[i+1]) )
                j++;
        }
        else if( sig[j] == text[i] || text[i] == '?' )
        {
            j++;
        }
        else
        {
            printf("Match failed\n");
            break;
        }
    }

}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

why can't you change the header file? If its on your computer than you can change it. Save a copy somewhere else and if changing the header file doesn't work then change it back.

Of course you can always just call the people who wrote the library and ask them.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

why would you want to return some integer instead of true/false? If bool is inappropriate for that function then just change the return type of the function.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you need to add the include path to mysql.h
INCLUDES="c:\mysql\include"
$(CC)-o mysqlrun $(INCLUDES) $(MYSQLCFLAGS) mysql.c $(MYSQLLIBS)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The structure is wrong -- need to add another character to each element for the null-terminator

struct bday{
	char month[3];
	char date[3];
	char year[5];
};

or just make them ints

struct bday{
	int month;
	int date;
	int year;
};
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Looks like the function is prototyped incorrectly. Change the prototype in the header file to match the library.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

another interesting thing is that when i try running the compiler from bin folder inside tc, it doesnt show any error mesage. but when i try running it from the shortcut on desktop it gives the following msg

invalid program file name, please check your pif file.

the title of this error msg box is
16 bit ms-dos subsystem.

You may need to add the tc\bin directory to your PATH environment variable. I don't recall exactly how to do that on XP, but if you hit Start -->Help, then enter "environment variables" it will tell you how to do it.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

1) both functions use the extern keyword incorrectly. extern means it is coded in some other translation unit, which the code you posted is certainly not.

2) can't tell just what the difference is because I don't know what the macro NEXT does. My guess is that it is causing recursion.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Create a 2d array called alpha with dimensions 5x208 that will contain alphabet characters i.e.

That is asking you to create a 2d character array that can contain 5 strings and each string can contain up to 208 characters. Like this: char alpha[5][208];

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

This appears to be some sort of 4GL SQL code that's written in original K&R style. Other than that, I don't really know what the code is doing.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

There are two versions of getline() -- one for character arrays and the other for std::string. If variable colour is a character array then use cin.getline(colour, sizeof(colour)); , otherwise if colour is a std::string then getline(cin, colour);

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>> if (sig != text)
You can't use the same counter here because sig and text can be of different lengths.

If sig == "screeeeewxd" and text == "scr*w?d" then I would do this:

int main()
{
    char* text = "scr*w?d";
    char* sig = "screeeewxd";
    int i = 0;
    int j = 0;
    for(i = j = 0; text[i] && sig[j]; ++i )
    {
        if( text[i] == '*')
        {
            while( sig[j] && (sig[j] != text[i+1]) )
                j++;
        }
        else if( sig[j] == text[i] || text[i] == '?' )
        {
            j++;
        }
    }

}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>is it bad practice to put an assignment in an if statement?
IMO -- no, I have done that occasionally, especially in loops

int x;
while( (x = getnumber() ) == 0)
{
   // do something
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>for(i=0;i<=2;i++)
That will print 3 structures, not 2. what you want to do is use the < operator, not the <= operator.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Ahhhhhh,

I hope no one is mad about my title...

I'M MAD AS HELL AND I WON'T TAKE IT ANY MORE :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Does anyone know what the hell NicAx is rambling about? I read the whole post and still don't know -- something about difference between married and single people.

Advice: if you are jealous then get married!

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

closed

Nick Evan commented: thanks +14
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>I've seen a few posts on here talking about "databases" as if they were just files

Yes, database is a very broad term that describes everything from a simple text file to the most comples SQL databases such as MySQL.

>>I googled and found sqlapi++, is that the best way to go?
It appears to be ok, but I have not used it myself. But I would say that it is much better than not using any classes and attempting to do it all from scratch.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 28: delete that if statement because if the program gets that far its 100% true that the word was not found. So all you need to do at that point is display the error message.

lines 22 and 23: you have already read the line that begins "Hardtop" on line 18. Lines 22 and 23 just read the next line. What you need to do is use stringstream to split the line that was read on line 18

stringstring str(line);
str >>  body->style >> body->doorCount;

Another way to do it is to change the loop on line 18. The problem with this approach is that it will destroy the values in that structure/class. So if that's not what you want then don't use it.

while( file >>  body->style >> body->doorCount)
{
    if( body->style == key)
          return true;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Welcome to the "old farts club" ;)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
if( this is true) // comments here
   do_something();

if, this and true should also be blue.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>char *array;
That is not a 2-dimensional array. char **array is how to declare it, using two stars not just one.

Here is one way to initialize it

char **array = 0;
array = new char*[rows];
for(int i = 0; i < rows; i++)
    array[i] = new char[columns];
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 21: remove the semicolon at the end

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

what version of windows is running on your computer? If you have Vista then I'm not supprised that tc won't run. Get yourself a newer free compiler, such as Microsoft VC++ 2008 Express or Code::Blocks.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I assumed (probably wrongly) every American knew USSC (US Supreme Court). Banning outsourcing is unconstitutional because it limits our freedoms (the 10th Amemdment)

The powers not delegated to the United States by the Constitution, nor prohibited by it to the states, are reserved to the states respectively, or to the people.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>im just reading a file in the server m/c and then printing it in client m/c ...so is it possible to do it in tcp ??

depends. MS-Windows not without a file transfer from server to client so that client can print it on its own machine. *nix: maybe if the server machine knows the tcp/ip address of the client's terminal.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

what is a "proc file"? If you want to find the size of a file that is stored on your hard drive then there are a cople opeions: (1) call _stat() function, or (2) open the file, seek to the end, then get the current file pointer position.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>if (seats[position]=0)
You need to use the boolean operator == instead of the assignment operator =.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

why don't you convert it yourself? If you need help converting something specific then ask and post what you have done. Nobody here is going to do your work for you.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I know what he meant - I was going on about what the president meant.

I think you are right -- Obama was probably talking about outsourcing US government contracts. Too bad he doesn't expand that to outsourcing all other jobs in US too, but that would quickly be declared unconstitutional by USSC.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Why is this thread being dug up from its grave? Narue isn't going anywere soon -- this thread was started long before she because a Super Mod.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If you want to convert that to C language then replace cout with printf() statements, fout with FILE, seeg() with fseek(), etc.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If you want the % sine then input the data as a string then convert to double laber so that the % symbol will be removed from the keyboard buffer.

std::string input;
cout << "Enter a percent";
getline(input, cin);
double n;
stringstream str(input);
str >> n;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Happygeek has devised a secret mathematical formula which determines the next member of the month

Its called "toss of the coin" :)

verruckt24 commented: Like it +3
nav33n commented: Heh! I think you are right.. +10
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

This guy was arrested somewhere in UK for laughing while driving.