S
Steve
Hello (and a happy new year)
I'm quite new to C++ and have to programm something for school and can't
get my head around
a couple of things, but at the moment this one is the most important for me:
I have defined a class String and before I go on I should mention that
I'm not allowed to use any pre-defined templates (no STL) and not the
standard C++ String class, kind of mean
Nevertheless I want to tokenize a String with a predefined delimiter,
which will be used later to
cut words out of a sentence.
String.cpp
String[] String::tokenize(const String s, char* delimiter)
{
String stringArray[];
// tokenize the String and put each word into the String array
...
return stringArray;
}
String.h
String[] tokenize(const String s, char* delimiters);
My first problem is that I get a bunch of errors for the header line
(the first is C3409, I'm using VC++ .NET),
I assume this is not the way how one should define an array return type?
I know I have a second problem too, because I have to define the size
of the array I want to return, but honestly I want to avoid that, I
would love to do that dynamicly
as in a Vector.
I'm quite new to C++ and have to programm something for school and can't
get my head around
a couple of things, but at the moment this one is the most important for me:
I have defined a class String and before I go on I should mention that
I'm not allowed to use any pre-defined templates (no STL) and not the
standard C++ String class, kind of mean
Nevertheless I want to tokenize a String with a predefined delimiter,
which will be used later to
cut words out of a sentence.
String.cpp
String[] String::tokenize(const String s, char* delimiter)
{
String stringArray[];
// tokenize the String and put each word into the String array
...
return stringArray;
}
String.h
String[] tokenize(const String s, char* delimiters);
My first problem is that I get a bunch of errors for the header line
(the first is C3409, I'm using VC++ .NET),
I assume this is not the way how one should define an array return type?
I know I have a second problem too, because I have to define the size
of the array I want to return, but honestly I want to avoid that, I
would love to do that dynamicly
as in a Vector.