Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Different ways to declare variables
- #include <iostream>
- using namespace std;
- int main()
- {
- /Ints
- int i1 = 1;
- cout << "i1 = " << i1 << endl;
- int i2;
- i2 = 2;
- cout << "i2 = " << i2 << endl;
- int i3(3);
- cout << "i3 = " << i3 << endl;
- int i4{ 4 };
- cout << "i4 = " << i4 << endl;
- //doubles
- double d1 = 3.3;
- double d2 = 11;
- //chars
- char c1 = 'a';
- cout << "ci = " << c1 << endl;
- bool flag = false;
- auto a1 = 1; //int
- auto a2 = 3.3; //double
- auto a3 = 'c'; //char
- auto a4 = "hello"; //c*
- auto a5 = true; //bol
- auto a6 = 3L; //Long
- auto a7 = 1'000'000'000'000; //Long Long
- auto a8 = 0xFF; //int (255) hex literal
- auto a9 = 0b111; //int (7) binary literal
- return 0;
- }
Add Comment
Please, Sign In to add comment