Last active
January 8, 2021 00:24
-
-
Save melvincabatuan/d95feb6390e534c9b01d01798130cf4f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
int main () | |
{ | |
std::string str1 ("The"); | |
std::string str2 ("the"); | |
std::string str3 ("fox"); | |
if (str1.compare(str2) != 0) | |
std::cout << str1 << " is not " << str2 << std::endl; // "The" is not "the" | |
std::cout << str1.compare(str2) << std::endl; // -1 "The" comes before "the" | |
std::cout << str2.compare(str3) << std::endl; // +1 "the" comes after or greater than "fox" | |
std::cout << str3.compare(str2) << std::endl; // -1 "fox" comes before "the" | |
return 0; | |
} | |
/* | |
English-language ASCII sequence: | |
blank ! " # $ % & ' ( ) * + , - . /0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ | |
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z[ \] ˆ_ | |
a b c d e f g h i j k l m n o p q r s t u v w x y z { } ~ | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment