# CSCI 103 Summer 2018: Introduction to Programming

## In-Class Exercises Set 2

Master List of Exercises

### Lecture 6

#### Practice Program on your VM

Guessing game Write a number guessing game that randomly chooses an integer between [0-19] and allows the user to try to guess it. Indicate higher or lower until they guess correctly (and output Win) or stop after 5 unsuccessful guesses and output Lose. Practice using functions by defining and repeatedly calling a function to perform one "turn" of the game at a time and return whether the user guessed the number correctly. The prototype is below:

bool guessAndCheck(int secretNum);

### Lecture 7

#### Example 2

Which of these do you think will compile?

char name[100] = "Dave";
char name[] = "Dave";
char name[5] = "Dave";
char name[4] = "Dave";