Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- string weather;
- cin >> weather;
- if (weather == "sunny") {
- cout << "It's warm outside!" << endl;
- }
- else {
- cout << "It's cold outside!" << endl;
- }
- return 0;
- }
- Решение с тернарен оператор:
- #include <iostream>
- using namespace std;
- int main() {
- string weather;
- cin >> weather;
- cout << "It's " << (weather == "sunny" ? "warm" : "cold") << " outside!" << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement