我有以下代码(我是线程世界的新手),但我不知道为什么它不起作用,因为我发现将参数传递给线程的正确方法与我所做的完全一样。 .. 因此,如果有人可以帮助解决这个问题,也许你们中的一个可以向我推荐一些教程或一些关于 C++ 中线程的内容
#include <iostream>
#include <thread>
#include <mutex>
#include <Windows.h>
#include <vector.hpp>
#include <functional>
void gotoxy(short, short);
void printAt(const char*, eestl::vector<int>&, short, short);
int main(int argc, char** args) {
eestl::vector<int> Odd{ 1,3,5,7,9 };
eestl::vector<int> Even{ 0,2,4,6,8 };
const char* odd_p = "Odd values: ";
short odd_x = 2;
short odd_y = 3;
const char* even_p = "Even values: ";
short even_x = 2;
short even_y = 13;
std::thread t1{ printAt, odd_p, Odd, odd_x, odd_y};
std::thread t2{ printAt, …Run Code Online (Sandbox Code Playgroud) I'm making a simple hangman game in c++ builder community edition and my game consists of buttons that represents letters and if the letter doesn't appear inside of the word you lose a life, and so on, and so on... But I'd though that is a little repetitive my code if I make a TButton for every letter in the abcedary. So I decide to make an array of TButton my surprise was when I code everything and any of …