C++ Online Compiler
Example: C++ program of decision making by using if-else ladder
C
C++
C#
Java
Python
PHP
main.cpp
STDIN
Run
// C++ program of decision making by using if-else ladder #include <iostream> using namespace std; int main() { int n; cout << "Enter an integer value::\n"; cin >> n; if (n == 0) { cout << "Fisrt condition is true.\n"; } else if (n == 1) { cout << "Second condition is true.\n"; } else if (n == 2) { cout << "Third condition is true.\n"; } else { cout << "Condition failed!\n"; } return 0; }
1
Output
Clear
ADVERTISEMENTS