Lesson 11Control Flow

If Statements

Learn about if statements in C++ programming!

main.cpp
#include <iostream>
using namespace std;

int main() {
    int score = 85;

    if (score >= 90) {
        cout << "Excellent! You got an A!" << endl;
    } else if (score >= 80) {
        cout << "Great job! You got a B!" << endl;
    } else if (score >= 70) {
        cout << "Good! You got a C!" << endl;
    } else {
        cout << "Keep practicing!" << endl;
    }

    return 0;
}