Concept Flow - Built-in data types
Start
Declare variable with built-in type
Assign value
Use variable in operations
Output or store result
End
This flow shows how built-in data types are declared, assigned values, used, and then output or stored.
#include <iostream> int main() { int a = 5; float b = 3.2f; char c = 'X'; bool d = true; std::cout << a << b << c << d; return 0; }
| Step | Action | Variable | Value | Output |
|---|---|---|---|---|
| 1 | Declare int a | a | undefined | |
| 2 | Assign 5 to a | a | 5 | |
| 3 | Declare float b | b | undefined | |
| 4 | Assign 3.2 to b | b | 3.2 | |
| 5 | Declare char c | c | undefined | |
| 6 | Assign 'X' to c | c | 'X' | |
| 7 | Declare bool d | d | undefined | |
| 8 | Assign true to d | d | true | |
| 9 | Output variables | a,b,c,d | 5,3.2,'X',true | 53.2X1 |
| 10 | End of program |
| Variable | Start | After Step 2 | After Step 4 | After Step 6 | After Step 8 | Final |
|---|---|---|---|---|---|---|
| a | undefined | 5 | 5 | 5 | 5 | 5 |
| b | undefined | undefined | 3.2 | 3.2 | 3.2 | 3.2 |
| c | undefined | undefined | undefined | 'X' | 'X' | 'X' |
| d | undefined | undefined | undefined | undefined | true | true |
Built-in data types in C++ include int, float, char, bool. Declare variables with type, assign values. Use 'f' suffix for float literals. Bool prints as 1 (true) or 0 (false). Variables hold undefined data before assignment.