Variables store values that later expressions can reuse.

Variables

variables.cpp
#include <iostream>

int main() {
    int unitPrice = ;
    int quantity = 3;
    int total = unitPrice * quantity;

    std::cout << "unit=" << unitPrice << std::endl;
    std::cout << "total=" << total << std::endl;
    return 0;
}
#include <iostream>

int main() {
    int unitPrice = ;
    int quantity = 3;
    int total = unitPrice * quantity;

    std::cout << "unit=" << unitPrice << std::endl;
    std::cout << "total=" << total << std::endl;
    return 0;
}
#include <iostream>

int main() {
    int unitPrice = ;
    int quantity = 3;
    int total = unitPrice * quantity;

    std::cout << "unit=" << unitPrice << std::endl;
    std::cout << "total=" << total << std::endl;
    return 0;
}
variable A variable has a type, a name, and a value.