Strange output in c++
<pre><code>#include &lt;iostream&gt;
#include &lt;string.h&gt;
#include &lt;iomanip&gt;
#include &lt;cstring&gt;
#include &lt;cassert&gt;
using namespace std;

#ifndef _TYPE_H
#define _TYPE_H

enum CardSuitType {DIAMOND,HEART,CLUB,SPADE};//enum for the suit type

struct card // creates the structure for cards
{
    CardSuitType suit; //declares suit type
    int numValue; // numerical value of the card
    int pointValue; // point value of the card
};

const int DECK_SIZE = 52;//constant for the max size of the deck
const int HAND_SIZE = 13;//constant for the max size of hand


#endif  /* _TYPE_H */
</code></pre>

<p>#include "type.h"</p>

<pre><code>#ifndef _CARDCLASS_H
#define _CARDCLASS_H

class CardClass {
public:
    CardClass();//default constructor

    void ShuffleCards();//shuffles the deck
    card DealCards();//deals one card to whoever calls the function
    void Print();//Prints the deck of cards


private:
    card deck[DECK_SIZE]; //initial deck
    int cardsLeft; //cards left in deck

};

#endif  /* _CARDCLASS_H */

//////start CardClass.cpp


#include "CardClass.h"
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;


//Default Constructor for the Card Class
//Creates a deck of 52 cards 13 of each suit
CardClass::CardClass()
{
    cardsLeft = 52;
   for(int i = 0; i &lt;= 12; i++)//sets all the diamond cards
    {
        deck[i].numValue = i+1;
        deck[i].pointValue = 0;
        deck[i].suit = DIAMOND;
    }
    for(int i = 13; i &lt;=25; i++)//sets the club cards
    {
        deck[i].numValue = i-12;
        if(i-12 == 10)//checks for jack of clubs
            deck[i].pointValue = -100;
        else//for all other cards
            deck[i].pointValue = 0;
        deck[i].suit = CLUB;
    }
    for(int i = 26; i &lt;= 38; i++)//sets all the heart cards
    {
        deck[i].numValue = i-25;
        if(i-25 &lt; 10)//checks for card value less than 10
            deck[i].pointValue = 5;
        else//checks for 10, jack, queen, king
            deck[i].pointValue = 10;
        deck[i].suit = HEART;
    }
    for(int i = 39; i &lt;= 51; i++)//sets the spade cards
    {
        deck[i].numValue = i-38;
        if(i-38 == 11)//checks for jack of spades
            deck[i].pointValue = 100;
        else//for all other cards
            deck[i].pointValue = 0;
        deck[i].suit = SPADE;
    }


}

/*
 * ShuffleCards: Shuffles the deck of cards in a random order.
 * Precondition: An object of CardClass has been constructed
 * Postcondition: The deck of cards is shuffled.
 *
 */
void CardClass::ShuffleCards()
{

    card temp;
    for(int i = 0; i &lt; DECK_SIZE; i++)//goes through the deck and swaps with a random card
    {
        int random = rand() %DECK_SIZE;
        temp = deck[i];
        deck[i] = deck[random];
        deck[random] = temp;
    }
}

/*
 * DealCards: Deals a card to a user
 * Precondition: deck has been initialized
 * Postcondition: a card is "dealt" (returned) to the caller
 */
card CardClass::DealCards()
{
    cardsLeft--;
    return deck[cardsLeft];
}

/*
 * Print: Prints the deck in a tabled format
 * Precondition: deck has been initialized
 * Postcondition: the contents of the deck are outputted
 *                  on the screen
 */

void CardClass::Print()
{

    //output the table head
    cout &lt;&lt; setw(20) &lt;&lt; left &lt;&lt; "Suit Type"
         &lt;&lt; setw(20) &lt;&lt; right &lt;&lt; "Number Value"
         &lt;&lt; setw(20) &lt;&lt; right &lt;&lt; "Point Value"
         &lt;&lt; endl;

    //output the cards
    for(int i = 0; i &lt; DECK_SIZE; i++)//moves through the hand
    {
      string value = " ";//string for Face cards
      string suit[4] = {"Diamond", "Heart","Club", "Spades"};//String for suit values
      string num[13] = {"A","2","3","4","5","6","7","8","9", "10", "Jack","Queen","King"};

        //output deck in tabular format.
         cout &lt;&lt; setw(20) &lt;&lt; fixed &lt;&lt; left &lt;&lt; suit[deck[i].suit]
             &lt;&lt; setw(20) &lt;&lt; fixed &lt;&lt; right &lt;&lt; num[deck[i].numValue]
             &lt;&lt; setw(20) &lt;&lt; fixed &lt;&lt; right &lt;&lt; deck[i].pointValue
                &lt;&lt; endl;





    }
}
///////start main.cpp



#include &lt;stdlib.h&gt;
#include &lt;cassert&gt;
#include &lt;fstream&gt;
#include &lt;cstring&gt;
#include &lt;time.h&gt;
#include "CardClass.h"
#include "PlayerClass.h"
using namespace std;

/*
 *
 */
int main(int argc, char** argv)
{

    srand(time(0));//primes random

    CardClass deck;//local deck of cards
    PlayerClass player[4];//array or players to be dealt

    deck.ShuffleCards();//shuffles the deck
    deck.Print();//prints the deck
    for(int i = 0; i &lt; DECK_SIZE; i++)//goes through deck
    {
        player[i%4].AddACard(deck.DealCards());//adds cards to a player's hand
    }
    for(int i = 0; i &lt; 4; i++)//goes through array of players
    {

        player[i].SortCard();//sorts the hand of the player
    }
    for(int i = 0; i &lt; 4; i++)//goes through array of players
    {
       cout &lt;&lt; endl &lt;&lt; endl//prints player hand information.
            &lt;&lt; "Player "&lt;&lt; i+1 &lt;&lt; endl
             &lt;&lt; player[i];
    }



    return (0);
}
</code></pre>

<p>It compiles and outputs completely fine in both Windows and the Debian client I am required to use for school, but I much prefer to develop in ubuntu.</p>

<p>It outputs</p>

<pre><code>Suit Type                   Number Value         Point Value
Heart                                  6                   5
Spades                              King                   0
Spades                                 7                   0

&gt; Club                                   2                   0 Heart    
&gt; 8                   5 Spades                                 6        
&gt; 0 Spades                                10                   0 Diamond
&gt; Jack                   0 Club                                   5     
&gt; 0 Club                                King                   0 Diamond
&gt; King                   0 Club                                   6     
&gt; 0 Heart                               Jack                  10 Diamond
&gt; 5                   0 Spades                             Queen        
&gt; 100 Diamond                            Queen                   0
&gt; Spades                                 8                   0 Heart    
&gt; 10                   5 Club                                   7       
&gt; 0 Diamond                                6                   0 Diamond
&gt; 10                   0 Spades                              Jack       
&gt; 0 Spades                                 2                   0 Club   
&gt; 8                   0 ��5���d             �=; 6t�� ��5��HcD$
&gt;          H���H�=��5H�����:
&gt;                            H�Ā�4���H�=j�5H���;
&gt;                                               H�Ā�G���H�=K�5H�����:
&gt;                                                                    H�Ā�g���H�=,�5H�����: �5H�����:�Ā�����H�=
&gt;          H�Ā�����H�=��5H�����:
&gt;                               H�Ā�����H�=��5H����C:
&gt;                                                    H�Ā�����H�=��5H����T:
&gt;                                                                         H�Ā�����zLc҅�H�O�VF�D�F��D�FD�V
&gt; t/�?����A����)�Hc�H��H�B�����A��Hc�H��H�Mc�H�NJ��H�F(1�DH�H)�H������V���H���5d�������fff.�H��t{H��tv�WH�O��tKH�L�L�O(�A�H����I9щI�@vI9�H�HF�H�1��H��H�1�H��i�mN�A90%�����1��H�A�5d�������fff.�USH��H��H����V���������L�F���E�1���A���nHc�H��~M�A�_
&gt;                                                                             N���A���������)�i�����i��)�iɧAȍ�����I�A�
&gt;                                             �H��H9�|�HcC �l�L��l-�I��H�1���x@H�t$
&gt;       H�߃���������u�1�H��[]ø�����H�\$�H�l$�H��L�d$�H��(H��!H�AH��t�q����@
</code></pre>

<p>When I use the debugger it is all put onto the screen during deck.Print();</p>
