Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 开发C++;赋值'const char[10]';改为`字符[21]'; #包括 #包括 使用名称空间std; 结构信息{ 字符名[21]; }infot[4]; int main() { infot[0].name=“程序1”; cout_C++ - Fatal编程技术网

C++ 开发C++;赋值'const char[10]';改为`字符[21]'; #包括 #包括 使用名称空间std; 结构信息{ 字符名[21]; }infot[4]; int main() { infot[0].name=“程序1”; cout

C++ 开发C++;赋值'const char[10]';改为`字符[21]'; #包括 #包括 使用名称空间std; 结构信息{ 字符名[21]; }infot[4]; int main() { infot[0].name=“程序1”; cout,c++,C++,您应该使用strcpy()来复制c样式的字符串 #include<iostream> #include<conio.h> using namespace std; struct Infor{ char name[21]; }infot[4]; int main() { infot[0].name="PROGRAM 1"; cout<<infot[0].name; getch(); return 0;

您应该使用
strcpy()
来复制c样式的字符串

#include<iostream>
#include<conio.h>
using namespace std;
struct Infor{
       char name[21];

       }infot[4];
int main()
{
    infot[0].name="PROGRAM 1";
    cout<<infot[0].name;
    getch();
    return 0;
}

您应该使用
strcpy()
来复制c样式字符串

#include<iostream>
#include<conio.h>
using namespace std;
struct Infor{
       char name[21];

       }infot[4];
int main()
{
    infot[0].name="PROGRAM 1";
    cout<<infot[0].name;
    getch();
    return 0;
}

使用
名称空间std;
谢谢,伙计。工作起来很有魅力。我是编程新手,为什么我不应该使用namspace std;?看。使用
名称空间std;
谢谢,伙计。工作起来很有魅力。我是编程新手,为什么我不应该使用namspace std;?看。使用
名称空间std;
不是很好的做法。我是编程新手,为什么不应该使用namspace std看见
#include<iostream>
#include<string>
using namespace std;
struct Infor{
       string name;
       int acn;
       int pin;
       int balance;
       }infot[4];
int main()
{
    infot[0].name = "PROGRAM 1";
    cout<<infot[0].name;
    return 0;
}