我已经在控制台中用C++创建了运行迷宫游戏。C++迷宫计数传递时间
我想添加函数来计算玩家通过迷宫所需的时间。
通过迷宫后可显示总时间。
我真的很感激任何帮助或想法。
游戏主循环看起来就像这样:
do {
show(); // function do display maze , 2d array
cout << "Your position: " << x << " " << y << endl;
cout << "Coins gained: " << coins << endl;
cout << "blahblahblah" : "<<endl;
m = getche();
cout << endl;
move(m); // function to recognize which way player want to go, including checking for not going through the wall
cout << endl;
system("CLS");
} while (x != 12 || y != 18 || coins < 10); //for pass the maze player have to move on these position and gain x coins
system("CLS");
cout << "You Won!" << endl;
cout << "Click enter to move on. \n";
你的帖子不清楚你实际需要什么帮助。你有一个_specific_问题或什么_specific_你需要帮助吗? \ –
如果你的编译器支持C++ 11'std :: chrono'将会是开始的地方:http://en.cppreference.com/w/cpp/chrono – drescherjm