A, string type
- Header file: include
- With scanf, use the fetch address character &
- If you want to use the compare function to compare
- Use scanf may occur mistakes questions in the test point, you can use cin
string s1, s2;
s1.compare(s2) == 0;
如果相等就是返回0
Two, char array
- Header file: include
- Using the comparison function strcmp ();
- In scanf, fetch address character may not be used.
char s1[12], s1[13];
strcmp(s1, s2) == 0;
(s1 > s2) > 0;
(s1 < s2) < 0;