我的情况的一个例子是当我在main中添加一个cout时,当我构建并运行程序时,cout从未显示(这是第二行代码所以我不相信这个问题与代码)。
我还应该提一下,我没有做这个项目,一个小组成员做了。所以我必须创建一个工作区并以这种方式添加现有的项目文件。除了我指定的问题,其他一切都像魅力一样。
我尝试过的一些事情包括构建,重建,停止和恢复构建,关闭和重新打开工作区,关闭和重新打开程序,创建新工作区,重建项目,重新加载工作区,重建工作区,并清理工作区。这些都没有奏效。我不知道还能做什么。
有很多类和头文件,所以我需要花一些时间在这里添加所有这些文件但是现在我会给你主要的:
#include <iostream>
#include "Functions.h"
#include "Charge.h"
#include "Grid.h"
#include "Property.h"
using namespace std;
int main()
{
cout << "Welcome to the world of Monopoly\n";
cout << endl << "I can work!"; # This is the cout that I added and was ignored.
//Get the number of players
int numberOfPlayer;
setNumberOfPlayer(numberOfPlayer);
//Get the name of each player
Player *players = new Player[numberOfPlayer];
setNameOfPlayer(players, numberOfPlayer);
//Initialize the map
cout << "Loading...";
//Current map size is 10 grids
int mapSize = 10;
Grid *grids[mapSize];
initializeGrids(grids, mapSize);
//progress is used to record a player's position and whether the player is bankrupt
Progress *progress = new Progress[numberOfPlayer];
initializeProgress(progress, numberOfPlayer);
cout << "Complete\n\n";
//Start a round. Iteration will continue if the game is not over.
//Game is over when only one player is not bankrupt
int round = 0;
bool gameOver = false;
while (!gameOver) {
gameOver = roundStart(round, players, numberOfPlayer, grids, mapSize, progress);
round++;
}
//Print out the winner
printWinner(players, numberOfPlayer, progress);
return 0;
}
答案 0 :(得分:-1)
声明: cout&lt;&lt; endl&lt;&lt; “我可以工作!”; 效果很好,它会输出你的字符串。好的,您可以尝试 cout&lt;&lt; “\ n我可以工作!”; 。
答案 1 :(得分:-1)
订单问题,请尝试
cout << "I can work!" << endl;