由于某种原因,我的 cout 语句无法在我的终端上正确打印。它创造了空间。当我有以下代码时:
void Test::testSorted(){
vector<int> unsorted = {4, 6, 5, 2, 1, 3};
vector<int> sorted = {1, 2, 3, 4, 5, 6};
cout << "Testing isSorted function for unsorted Pancake ... : " << endl;
game.setPancakeStack(unsorted);
bool condition1 = game.isStackSorted();
cout << "Testing isSorted function for sorted Pancake ... : " ;
game.setPancakeStack(sorted);
bool condition2 = game.isStackSorted();
}
终端以确切的空间量精确输出:
Testing isSorted function for unsorted Pancake ... :
Testing isSorted function for sorted Pancake ... :
注意:我一直在为一个项目使用 ncurses,我觉得这可能弄乱了我的外壳。但我什至不知道去哪里解决这个问题