0

I have this program (below). I have everything working like I want except for the first entry in the cout statement in the function displayOne(). The output is displayed below. How do I fix the first entry (#1009) to line up with the rest?

enter image description here


    void displayOne(int serialNum)
    {
        int bucket = hashFunction(serialNum);
        ShipRecord* next = hashTable[bucket];
        
        while (next != nullptr )
        {
            if (serialNum == next->serialNum)
            {
                cout<<next->serialNum << setw(10)
                    << next->shipType <<setw(10)<<" "
                    <<left<<setw(25)<< next->name << setw(10)
                    << next->year << setw(10)
                    << next->cap << setw(10) << endl;
                return;
            }
            next = next->link;
        }
        
            cout << serialNum << " <- This ship record does not exist." << endl;
        
    }

0 Answers0