cout 语句中的第一个条目被点击

问题描述

我有这个程序(如下)。除了函数 displayOne() 中 cout 语句中的第一个条目外,我的所有工作都像我想要的那样工作。输出如下所示。如何修复第一个条目 (#1009) 以与其余条目对齐?

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;
        
    }

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)