What is the size of an Int data type?
What data does it hold?
32b
whole numbersWhat is the max value of a signed 32b int?
(2^31)-1
(INT_MIN, INT_MAX, etc)
int8_t holds how much data?
What kind of data?
Signed Integer (Whole #s)
What does including iostream do?
I/O (input and output)
Mainly this is cout and cin
What is the size of a Double data type?
What data does it hold?
64b
floating point
int a = INT_MAX;
a++;
cout << a << endl;
What is the value of a?
INT_MIN or -(2^31)
uint16_t holds how much data?
What kind of data?
Unsigned integer, so non negative whole #s
Break them up using <<
Ex/ cout << "Hello " << "World! " << 42;What is the size of a Bool data type?
What data does it hold?
8b
True or False
What formulas can be used to find the max/min size of a signed int?
Max: 2^(b-1)-1
Min: -(2^(b-1))
int a = INT_MIN;
a--;
cout << a << endl;
What is the value of a?
INT_MAX or (2^31)-1
What is the max value an uint64_t can hold?
What command from <iostream> allows for user input on the command line?
Ex/ cin >> a;
This data type holds a smart array of characters.
Can it be used without being included? (#include<...>)
No, must be included as #include<string>
What formulas can be used to find the max/min size of an unsigned int?
Min: 0
Max: (2^b)-1
unsigned int a = 0;
a--;
cout << a << endl;
What is the value of a?
UINT_MAX or (2^32)-1
unsigned int = what cstdint data type
uint32_t
Debug the small program:
#include<iostream>
int main() {
cout << "Hello World!";
return 1;
}So cout requires std:: added to them
What is the difference between long long and long long int?
Nothing, they are the exact same. Adding Int is unnecessary.
Without using <cstdint> how can you create an unsigned int32?
unsigned int a;
uint8_t val = 254;
val++;
What is the value of val?
255 :)
When making an int using <cstdint> what format can you follow?
ex/ int8_t, uint16_t, etc
If signed: add nothing
If unsigned: add u
Then add int
Then add size (8,16,32,64)
Then add _t
What does the code do, (assume namespace std and iostream/string)
string s;
cin >> s;
cout << "Hello, " << s;
Allows user input (cin) for string s, then states "Hello, " then s.