#include<iostream> voidmain(void) { if("test"=="test") { cout<<"相等"; } else { cout<<"不相等"; } } |
#include<iostream> #include<string> usingnamespacestd; voidmain(void) { if(strcmp("test","test")==0) { cout<<"相等"; } else { cout<<"不相等"; } cin.get(); } |
#include<iostream> #include<string> usingnamespacestd; voidmain(void) { chartest[]="teststr!"; charstr[15]; strcpy(str,test); cout<<str<<endl; inta[]={1,2,3,4,5}; intb[5]; memcpy(b,a,sizeof(a)); for(inti=0;i<5;i++) { cout<<b[i]<<","; } cin.get(); } |