可以对数组名直接输入吗(字符数组)
#include <iostream>
using namespace std;
#include<stdio.h>
int main()
{
char name[40];
cout << "Hello, C++!" << endl;
cin >> name;
cout << "My name is " << name << "."<<endl;
return 0;
}
cin>>name是语法错误的吗
可以对数组名直接输入吗(字符数组)
#include <iostream>
using namespace std;
#include<stdio.h>
int main()
{
char name[40];
cout << "Hello, C++!" << endl;
cin >> name;
cout << "My name is " << name << "."<<endl;
return 0;
}
cin>>name是语法错误的吗
没错误,但是要规避空格
参考:https://www.cnblogs.com/ascall/p/8227587.html