Lesson 3C++ Basics

Data Types

Learn about data types in C++ programming!

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

int main() {
    // Integer types
    int wholeNumber = 42;

    // Floating point
    double decimal = 3.14159;
    float price = 9.99f;

    // Character and boolean
    char letter = 'A';
    bool isHappy = true;

    cout << "Integer: " << wholeNumber << endl;
    cout << "Double: " << decimal << endl;
    cout << "Boolean: " << isHappy << endl;

    return 0;
}