为什么编译后还没输入就出现乱码呢 请大佬们指点迷津
//比较两个c风格字符串的值#include<iostream>
#include<cstring>
using namespace std;
int main(void){
const int str_size=80;
char *str1,*str2;
str1=new char[str_size];
str2=new char[str_size];
if(str1==NULL || str2==NULL){
cout<<"No enough memory!"<<endl;
return -1;
}
cout<<"Enter two strings:"<<endl;
int result;
result=strcmp(str1,str2);
if(result<0)
cout<<str1<<"小于"<<str2<<endl;
else if(result>0)
cout<<str1<<"大于"<<str2<<endl;
else
cout<<str1<<"等于"<<str2<<endl;
delete [] str1;
delete [] str2;
return 0;
}
//编译后如下
/*Enter two strings:
Z?∮赑
--------------------------------
Process exited after 1.022 seconds with return value 0
请按任意键继续. . .
*/