你如何在句子中加一个字符。
例如,我有一个player1,想把player1添加到句子的开头“请输入你想洗牌的次数”。
我习惯了java,你只需在其中添加+即可连接变量和字符串
到目前为止,我有这个,但它不喜欢我键入的任何内容:
printf(&player1 + " please enter how many times you would like to shuffle the deck: "); int numShuf; scanf("%i", &numShuf);
如有任何帮助,我们将不胜感激
试试这个:
printf("%s please enter how many times you would like to shuffle the deck: ", player1);
printf 意思是打印格式化,因此您可以格式化要打印的内容,并将变量添加为参数。
printf