C++ 在C+中显示时使用单引号和双引号的不同答案+;
我在C++程序中用单引号显示了一条语句,我得到的答案是随机数,当我在C++中使用双引号时,它向我显示了该语句C++ 在C+中显示时使用单引号和双引号的不同答案+;,c++,C++,我在C++程序中用单引号显示了一条语句,我得到的答案是随机数,当我在C++中使用双引号时,它向我显示了该语句 cout << 'Hello world'; //gave me the random numbers cout << "Hello world"; //displayed me the statement i.e Hello world cout单引号用于字符: charc='A' 如果要打印一个多字符的字符串,请使用双引号: cout您正在尝试打印需要双引号
cout << 'Hello world'; //gave me the random numbers
cout << "Hello world"; //displayed me the statement i.e Hello world
cout单引号用于字符:
charc='A'代码>
如果要打印一个多字符的字符串,请使用双引号:
cout您正在尝试打印需要双引号的字符数组
char str[3] = "abc"; //an array of characters, use double quotes
str[0] = 'x'; //set a character in this array, use single quote
'表示单个字符,请使用“”表示字符串,您看到的随机内容是从该字符到第一个字符的计算机内存转储\0请看:这是一个多字符文本,请查看此帖子: