Mudanças entre as edições de "Exemplos de operações com strings no C++"
Ir para navegação
Ir para pesquisar
(Criou página com '=Iniciando Strings= =Comparando Strings=') |
|||
Linha 2: | Linha 2: | ||
=Comparando Strings= | =Comparando Strings= | ||
+ | |||
+ | <syntaxhighlight lang=c++> | ||
+ | |||
+ | #include <string> | ||
+ | #include <iostream> | ||
+ | #include <string.h> // para função de string C | ||
+ | |||
+ | using namespace std; | ||
+ | |||
+ | int main() { | ||
+ | string texto1 = "delta"; | ||
+ | string texto2 = "betaaaa"; | ||
+ | |||
+ | if(texto1>"beta") { | ||
+ | cout << "delta é maior..." << endl; | ||
+ | } | ||
+ | }return 0; | ||
+ | } | ||
+ | |||
+ | </syntaxhighlight> |
Edição das 12h11min de 19 de abril de 2022
Iniciando Strings
Comparando Strings
#include <string>
#include <iostream>
#include <string.h> // para função de string C
using namespace std;
int main() {
string texto1 = "delta";
string texto2 = "betaaaa";
if(texto1>"beta") {
cout << "delta é maior..." << endl;
}
}return 0;
}