Unimportant 18 Junior Poster

@deceptikon
Your solution is wrong.
In your solution, when he calls print() it will treat all of the pointers as articles no matter what they are.

Unimportant 18 Junior Poster

addArticle( ... ) will be interpreted in the context of the pointer.
You'll want to cast it first,

// C++11
auto Magazine((CMagazine*)A3);
// C++3
CMagazine * Magazine((CMagazine*)A3);

Before you call the function itself

Magazine->doSometing(  );



// To be quite honest it doesn't really matter what the buffer pointer is
L1.addArticle((void*)Thing); // Some other coders may yell at you if this isn't well documented
Unimportant 18 Junior Poster

Redefine SWAP this way.
#define SWAP(a,b) float * t=a;a=b;b=t;

I'm not sure how you can pass implicit type to the define pre-processor. If anyone has any idea, I'd love to know.

By the way, you could also perform a XOR swap.

#define SWAP(a,b) a^=b;b^=a;a^=b;
#define SWAPPTRCONT(a,b) *a^=*b;*b^=*a;*a^=*b;
Unimportant 18 Junior Poster
int threeDim[x][y][z];

Algorithm is a synonym of calculus, it means "method"

Unimportant 18 Junior Poster

He said,

but I still get an infinite loop when the input for ‘difficulty ‘ is not an integer.

Meaning he intends for the loop to end when difficulty is not an integer.

Unimportant 18 Junior Poster
    $files = array(  );
    $dir = opendir( $name );
    while( false !== ($file = readdir($dir)) )
    {
      if( $file != '.' && $file != '..' )
      {
        $pop = explode('.',$file);
        $ext = "";
        if(count($pop)>1) $ext = array_pop($pop);
        $files[implode('.',$pop)][] = $ext;
      }
    }
    closedir($dir);
    print_r($files);
Unimportant 18 Junior Poster
default:
cout << "\nYou have made an invalid choice." << endl;
return 0;
Unimportant 18 Junior Poster
printf("%d", expr);
printf("UINT:\t%u\tSYMBOL:%s\r\n", expr1, expr2);
// return type of expr, when evaluated, must match symbolic type given to printf ("%u, %s")
Unimportant 18 Junior Poster

You'll want to start with the PHP manual.

Here is the basic document regarding sessions.
This is the entire sessions document tree.
A specific document about the container $_SESSION[].

Unimportant 18 Junior Poster

Check in the textbook your teacher assigned to you for this class.

Unimportant 18 Junior Poster

In the copy constructor or method, copy all data or change all relevant pointers.

For example,

        struct Basic
        {
           char ** deep;
           int num;

           Basic & operator=(const Basic & b)
           {
             if( this == &b )   return *this;
             for(int i=0;i<num;++i) delete [] *(deep+i);
             delete [] deep;
             deep = new char * [b.num];
             for(int i=0;i<b.num;++i)
             {
               deep[i] = new char[MAX_LEN];
               memcpy(deep[i],b.deep[i],MAX_LEN);
             }
             return *this;
           }
        };

You do this because in the best case of a shallow copy, the pointer to array 'deep' is copied directly. There are many worse cases.

Alternatively, you can pass possession of the pointer to the newer object. Only one object should "own" the base pointer, assuming you [wisely] deallocate the memory during deconstruction.
That would look something like this

struct Basic
{
  // ...
  Basic & operator=(const Basic & b)
  {
    if( this == &b ) return *this;
    deep = b.deep;
    b.deep = NULL; // calling delete on a NULL ptr does nothing according to C standard.
    return *this;
  }
};

However, this means that the original class object can no longer access the "deep" array of string.
How you approach the problem is up to you.

rubberman commented: Please don't answer class problem questions like this! -3
Unimportant 18 Junior Poster

Ah, well in that case you're also wrong "in this thread"
since the OP stated "Define an array of pointers to the array"

Maybe you should calm down.
I'm sure you think you're right, it's natural or you wouldn't be arguing in the first place.
It's good to remember that the person you're arguing with also feels that way.

I don't think you've made strong points, other than the fact that you think the language is difficult to use.

deceptikon commented: Complete fail. -3