<分区>
我厌倦了解决为什么我的 ch[0] 的值是“Thomas EdisonÇ@”,而它应该是“Thomas Edison”
int main(){
using namespace std;
ifstream in("U2.txt");
int n;
in>>n; //n=rows, so in every line there will be "name surname", time, money
char ch[n][21]; //I'm trying to get Name+Surname which must be 20 char long
in.read(ch[0], 20);
cout << ch[0]; //but getting Thomas EdisonÇ@
return 0;}
它适用于一维 ch[21],但会有很多值,所以我想使用 ch[n][21]
欢迎任何其他开箱即用的解决方案,我累了