--- Pedro von Wald <[EMAIL PROTECTED]> wrote:
> Hello, I am new to the list; I had some experience
> with programmin gin
> the past with the Turbo Pascl, Clipper, Visual
> Basic, Applesoft, and
> some ansi C. But I haven't programmed anything from
> scratch since a
> long time. Now I am taking classes about C++. And I
> am stuck in a
> project that give a header file with class
> definiitions (private
> variables and public functions) and two other cpp
> files. One of the
> cpp file I have to define function that that would
> do the following:
> Union of two strings (if A=(a,b,c) and B=(b,c,d),
> then the A union B
> results in (a,b,c,d);
> Intersection if A=(a,b,c) and B=(b,c,d), then A=
> intersec. B results
> in (b,c); Difference if A=(a,b,c) and B=(b,c,d), the
> difference would
> be (a). It seems a simples thing at first, but I am
> stuck in it.
> The following is a sample code that I am trying to
> use in order to
> implemenet the Union with no success:
>
What are the data members of the class Set?
Why are you padding the Set s1 by copy instead of
const reference?
> Set Set::Union(Set s1)
> {
> int n, m, index(0);
Why are you initializing the char arrays with a
newline character?
> char temp2[40]="\n";
> char temp[40]="\n";
Where did Contents come from?
> for(n=0; n<=Contents.size()-1;n++)
> {
> for(m=0;m<=s1.Contents.size()-1;m++)
> {
> if(Contents.at(n)!= s1.Contents.at(m))
> temp[m] = Contents.at(n);
> }
> }
>
> for(int x = 0; x <= strlen(temp); x++)
> {
> for(int n = 0; n <= strlen(temp); n++)
> {
> if(temp[x] != temp[n])
> {
> index = index + 1;
> }
>
> }
>
> }
>
> return (s1);
> }
>
> Any help would be great
> Thanks
> pdwald
>
>
What are you inputting into the function?
What are you getting for an answer?
We need more information to be able to help you.
Ray
____________________________________________________________________________________
The fish are biting.
Get more visitors on your site using Yahoo! Search Marketing.
http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php