FAQ Part 2: Basic Syntax and Structure

What is the structure of a basic C++ program?

#include <iostream>
using namespace std;

int main() {
    cout << "Hello, World!" << endl;
    return 0;
}

What are C++ data types?

  • Integer: int, short, long, long long
  • Floating-point: float, double, long double
  • Character: char
  • Boolean: bool
  • Void: for functions that return nothing

What are constants and literals?

  • Constants: Declared using const or #define
  • Literals: Values used directly in code, e.g. 42, 3.14, 'a', "Hello"