char str1[] = "abc";
char str2[] = "abc";
CONST char str3[] = "abc";
const char str4[] = "abc";
const char* str5 = "abc";
const char* str6 = "abc";
cout << boolalpha << ( str1==str2 ) << endl; // 输出什么?false
cout << boolalpha << ( str3==str4 ) << endl; // 输出什么?false
cout << boolalpha << ( str5==str6 ) << endl; // 输出什么?true
#include <iostream>
usingnamespace std;
int main()
{
bool b=true;
cout <<"b="<< b << endl;
b =false;
cout <<"b="<< b << endl;
cout <<"b="<< boolalpha << b << endl;
cout << b << endl;
bool a =true;
cout <<"a = "<< a << endl;
}
输出结果:
b=1
b=0
b=false
false
a =true
char str2[] = "abc";
CONST char str3[] = "abc";
const char str4[] = "abc";
const char* str5 = "abc";
const char* str6 = "abc";
cout << boolalpha << ( str1==str2 ) << endl; // 输出什么?false
cout << boolalpha << ( str3==str4 ) << endl; // 输出什么?false
cout << boolalpha << ( str5==str6 ) << endl; // 输出什么?true
#include <iostream>
usingnamespace std;
int main()
{
bool b=true;
cout <<"b="<< b << endl;
b =false;
cout <<"b="<< b << endl;
cout <<"b="<< boolalpha << b << endl;
cout << b << endl;
bool a =true;
cout <<"a = "<< a << endl;
}
输出结果:
b=1
b=0
b=false
false
a =true