Answer:5. Consider the following code segment:
void main()
{
int a,b;
string s1("aabbcc");
string s2("bbccaa");
a = s1.compare(4,2,s2,2,2);
b = s1.compare(0,2,s2,0,2);
if(a == 0)
cout<<"Equal , ";
else
cout<< "Not equal ,";
if(b ==0)
cout<<"Equal";
else
cout<<"Not Equal";
}
What will be the output of the above code?
Options
a) Not Equal , Equal
b) Not Equal , Not Equal
c) Equal , Equal
d) Equal , Not Equal
Answer : d) Equal , Not Equal