IM困惑,在我的編碼C++ 請幫助我..如何加入的strcpy在C++
#include <conio.h>
#include <string.h>
#include <iostream.h>
main()
{
char h1[80];
char h2[80];
char move[80];
clrscr();
cout<<"Character 1 = ";
gets(h1);
cout<<"Character 2 = ";
gets(h2);
strcpy(move, h1);
cout<<"Result = "<<move;
getch();
}
我要像
Move = h1+h2;
使用'的std :: string'對於'h1'和'move',然後'move = h1 + h2;'。 – juanchopanza 2014-10-02 06:35:03
你使用什麼編譯器?請不要說它是古老的Turbo C++。 – PaulMcKenzie 2014-10-02 06:35:37
永遠不會使用'gets()'。這是一個安全漏洞。使用'fgets()'或其他東西。 – 2014-10-02 06:36:49