diff --git a/string.cpp b/string.cpp index 1f79de0..8e19ce6 100644 --- a/string.cpp +++ b/string.cpp @@ -8,16 +8,23 @@ int main() string s, s1; s = "HELLO"; s1 = "HELLO"; + int check1=0,check2=0; if(s.compare(s1) == 0) + { + check1=1; cout << s << " is equal to " << s1 << endl; - else + } + if(check1==0) cout << s << " is not equal to " << s1 << endl; s.append(" WORLD!"); cout << s << endl; printf("%s\n", s.c_str()); if(s.compare(s1) == 0) + { + check2=1; cout << s << " is equal to " << s1 << endl; - else + } + if(check2==0) cout << s << " is not equal to " << s1 << endl; return 0; -} \ No newline at end of file +}