【发布时间】:2015-05-12 02:37:23
【问题描述】:
对于我的程序,我有一个高分部分。我得到了一个字符串的输入,但是我现在怎样才能使这个字符串等于一个 char 数组呢?仅供参考:字符串playersName 已经填写了名称。这是我的代码:
class Highscore
{
public:
char name[10];
...[Code]...
}
...[Code]...
// Declare variables *The playersName will be filled out already*
string playersName = "";
...[Code]...
// How can I get the data[playerScore].name equal my playersName string?
cin.get (data[playerScore].name, 9);
// I know cin.get will be not in the code since I already get the players name with the string
【问题讨论】: