0

如何在句子中添加字符。

例如,我有一个 player1,想将 player1 添加到句子的开头“请输入你想洗牌的次数。

我习惯了java,你可以在其中添加+来连接变量和字符串

到目前为止我有这个,但它不喜欢我输入的任何内容:

printf(&player1 + " please enter how many times you would like to shuffle the deck: ");
int numShuf;
scanf("%i", &numShuf);

任何帮助将不胜感激

4

1 回答 1

2

尝试这个:

printf("%s please enter how many times you would like to shuffle the deck: ", player1);

printf表示打印格式化,因此您可以格式化要打印的内容并将变量添加为参数。

于 2013-04-18T00:42:38.953 回答