Font size
WorksheetsTypes and IO in C++
Total questions: 26
Worksheet time: 20mins
Temp0 = 1;
(a)
temp1 = 5.4
(a)
Temp0 = -1;
(a)
temp1 = 5.444444444
(a)
What type is a whole number that is 2 bytes long
Short
Int
Long int
float
What type is a whole number that is 4 bytes long
Short
Int
Long int
float
What type is a decimal or floating point number that is 4 bytes long
Short
Int
Long int
float
If you wanted to do operations on a string, what header would you include.
#include <iostream>
#include <string>
#include <iomanip>
#include <vector>
If I wanted to do a cout or a cin what header do I need to include?
#include <iostream>
#include <i/o>
print("hello world!")
#include <format>
aCharacter = 'A';
Char
string
int
float
aCharacter = "A";
Char
string
int
float
How long is a byte in bits?
(a)
What's the difference between a double and float
A float is 4 bytes and a double is 8 bytes
Heart Disease
A float can hold 6 decimal places, and a double can hold 19 decimal places
One is bigger than the other
If Walter white wanted to store a constant value like PI in C, what would he do.
#define PI 3.14
const float PI = 3.14;
float pi = 3.14;
double pi = 3.14;
If Gus Fring wanted to store a constant value like PI in C++, what would he do.
#define PI 3.14
const float PI = 3.14;
float pi = 3.14;
double pi = 3.14;
If the great Emperor Calus "May the witness bless his name", wanted to store a decimal with more than 7 decimal places in C++ what type would he use?
float
double
int
an engram
If Alex, wanted to store a number that has no negatives what would he use?
float
double
int
unsigned int
If Eric Ramirez, wanted to store a very big number that has no negatives what would he use?
float
double
size_t
unsigned int
Explain what a float is in your own words
Explain what a int is in your own words
Explain what a double is in your own words
A write a constant in C
A write a constant in C++
What would use a int for and not a float.
What would use a float for and not a int.
Explain what you learned in this session
