Created by Oscar Rojas
over 4 years ago
|
||
Question | Answer |
How do you access a function/class in the Standard Library? | By using the "std" namespace followed by two semi-colons "::" |
As a good rule of thumb, how should you gain input from the user? | By using "std::getline( cin, std::string var);" (to be noted that the input it saved as a string in the var) |
Convert n into its numerical value given: #include <iostream> #include <string> // Allows for use of strings std::string n; int num; std::cout<<"Enter a #"<< std::endl; std::getline(std::cin, n); | #include <iostream> #include <string> // Allows use of strings #include <sstream> //"stringstream" std::string n; int num; std::cout<<"Enter a #"<< std::endl; std::getline(std::cin, n); std::stringstream(n) >> num; |
How do you get the size of a type & what will it be measured in? | sizeof(var); // returns size in bytes (8 bits) |
Void is an incomplete type, as a result what may be disallowed? | Objects, arrays & references |
What are the differences between signed & unsigned types? | unsigned types are 2x as big, in value range, but ignore the sign. (Range: [0, 2x]) |
How would you resize an int? | precede it with "__type n" (where n = the # of Bytes) or use types "short" to shrink & "long" to expand |
what is the range of values an int (__int32) may hold? | [ -2,147,483,648 , +2,147,483,648 ] |
List the floating point types from least to most accurate: | float, double, long double |
What is the size of int, long & pointer in 32-bit Systems? | int is 16 bits, while long & pointer are 32 bits. or int, long & pointer are 32 bits |
What is the size of int, long & pointer in 64-bit Systems? | int & long are 32 bits, while pointer is 64 bits. or int is 32 bits, while long & pointer are 64 bits |
Want to create your own Flashcards for free with GoConqr? Learn more.