Variables of different data types
Variables of different data types
Here’s how we create variables of different data types:
#include <iostream>
int main() {
int i = 42; // Integer variable
float fl = 3.14f; // Floating-point variable
char c = 'A';
bool b = true;
std::cout << "Integer variable: " << i << std::endl;
std::cout << "Float variable: " << fl << std::endl;
std::cout << "Character variable: " << c << std::endl;
std::cout << "Boolean variable: " << b << std::endl;
return 0;
}