Skip to content

Instantly share code, notes, and snippets.

@Thiago4532
Created May 21, 2019 22:23
Show Gist options
  • Save Thiago4532/f123e9030aa9dd848df0eff82fd89052 to your computer and use it in GitHub Desktop.
Save Thiago4532/f123e9030aa9dd848df0eff82fd89052 to your computer and use it in GitHub Desktop.
#include <iostream> // Necessita da iostream para funcionar
using namespace std;
int main() {
pair<int, string> A = {10, "Thiago"};
pair<int, string> B = {20, "Lawrence"};
pair<int, string> C = {20, "Davi"};
if(A < B) {
// A é menor do que B pois 10 é menor do que 20. (Primeiro ele compara o primeiro valor).
}
if(C < B){
// C é menor do que B nesse caso, pois como o primeiro valor é igual, ele compara pelo segundo. Como 'D' vem antes de 'L', C < B
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment