Week 5 (Interactivity) Flashcards
what is the preferred way to input a string?
getline(cin, inputLine);
what is the syntax for the get line function
getline(, )
how to get a char input and store it?
cin.get(ch); ch = cin.get
how to ignore characters in the buffer?
cin.ignore(n,c);
(n= numbers of characters to skip)
(c = character)
skips n characters or until c is encountered
how to get the length of a string?
integerIdentifier = stringIdentifier.length( )
How to concatenate strings?
+
What are c-strings?
Arrays of chars that act as strings.
how do you copy strings with string objects?
strcpy(name2, name)
how can you limit the amount of characters stored into a c-string
cin»_space; setw(n)»_space; word;
How do you read in a whole line with c string?
cin.getline(arrayVariable, size)
What to include math library functions
include
what to include for random numbers
include
what function to call to return a integer random number.
rand()
what does a seed value do?
Helps generate random numbers
How to set a seed value?
srand();