/
githubmirror
/
CPlusPlusThings
Обзор
Документация
Войти
/
githubmirror
/
CPlusPlusThings
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
practical_exercises/10_day_practice/day9/exception/3.cpp
23 строки
485 B
zhangxing
support bazel complie this project and format code.
30 мар 2024, 17:00
30 мар 2024, 17:00
3c8a3f2
Код
Авторство
О чём код?
#include <iostream> using namespace std; void temperature(int t) { try { if (t == 100) throw "It's at the boiling point."; else if (t == 0) throw "It reached the freezing point"; else cout << "the temperature is OK..." << endl; } catch (int x) { cout << "temperature=" << x << endl; } catch (char const *s) { cout << s << endl; } } int main() { temperature(0); // L1 temperature(10); // L2 temperature(100); // L3 return 0; }