Data Loops

5.0(1)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/20

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 6:13 PM on 4/16/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

21 Terms

1
New cards

Data loop by char

char c;
while (in.get(c))
{

}

2
New cards

Data loop by token

string word;
while (in >> word)
{

}

3
New cards

Data loop by line

string line;
while (getline(in , line)
{

}

4
New cards

Data loop by line and char

string line;
while (getline(in, line))
{

for (char c : line)
{

}
}

5
New cards

Data loop by line and token

string line;
istringstream lineStream;
string word;
while (getline(in, line))
{
lineStream.clear()
lineStream.str(line);

// Do once each line

while (lineStream >> word)
{

// Do once each token in the line

}
}

6
New cards

Data loop by token and char

string word;
while (in >> word)
{

// Do once each token


for (char c : word)
{

// Do once each character in the token

}
}

7
New cards

Which operator gets numbers from input?

8
New cards

A loop that runs once for every word

Data loop by token

9
New cards

A loop that runs once for every character

Data loop by line

10
New cards

A loop that runs once for every line

Data loop by line

11
New cards

A loop that runs once for every word, treating each line separately

Data loop by line and token

12
New cards

A loop that runs once for each character, treating each line separately

Data loop by line and char

13
New cards

A loop that runs once for each character, treating each word separately

Data loop by token and char

14
New cards

"Count the number of duplicate words on each line"

Data loop by line and token

15
New cards

"Count the number of repeated characters in each word"

Data loop by token and char

16
New cards

"Print out only the words that start with an F"

Data loop by token

17
New cards

"Find the average of the numbers"

Data loop by token

18
New cards

"Print only the words not between a '

Data loop by char

19
New cards

Data loop by two tokens

string word;
int n;
while (in >> word && in >> n)
{

}

20
New cards

Data loop by five tokens

string word;
int i, j;
double d;
char c;
while (in >> word && in >> i && in >> j && in >> d && in >> c)
{

}

21
New cards

"Print a person's name and score only if their score is higher than the previous person's"

Data loop by two tokens.