Shared Flashcard Set

Details

C++ Basics: Data Types
Introduction to Data Types
10
Computer Science
Undergraduate 1
03/15/2013

Additional Computer Science Flashcards

 


 

Cards

Term
int
Definition

4 bytes

Holds integer values

Term
char
Definition

2 bytes

Holds a single keystroke.

Term
double
Definition

8 bytes

Holds decimal numbers.

Term
float
Definition

4 bytes

Holds decimal nubmers.

Term

What is the difference between:


unsigned int temperature;


and,


int temperature;

Definition

unsigned int only holds positive integers,

while int holds both negative and positive.

Term
string
Definition
The "string" data type is used for words.
Term

int *ptr;

double *pointer;

float *number;

Definition

1 byte.

Pointers can only point to memory addresses.

They are declared by placing an asterisk before the identifier:

 

int *ptr;

double *pointer;

float *number;

Term

Will the following code allow the user to enter his first name, a space, and his last name?

 

string fullName;

 

cin >> fullName;

Definition

No.

 

"cin >> fullName" allows for one word without spaces.

 

If spaces are desired, the code must be:

 

getline(cin, fullName);

Term
ofstream
Definition
ofstream is a special data type that allows the user to write to a file.
Term
ifstream
Definition
ifstream is a special data type that allows the user to read in from a file.
Supporting users have an ad free experience!