#include <iostream>
#include <string>
int main() {
std::string str1 = "MATA";
std::string str2 = "MAMA";
std::string str3 = "MAMA";
// Porównanie za pomocą operatora ==
if (str1 == str3) {
std::cout << "str1 i str3 są takie same" << std::endl;
} else {
std::cout << "str1 i str3 są różne" << std::endl;
}
// Porównanie za pomocą operatora !=
if (str1 != str2) {
std::cout << "str1 i str2 są różne" << std::endl;
}
// Porównanie za pomocą operatorów <, >, <=, >=
if (str1 < str2) {
std::cout << "str1 jest mniejsze od str2" << std::endl;
}
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: