CSCI 103 Fall 2017 Introduction to Programming

CSCI 103 Fall 2017: 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

More Arrays, Passing Arrays as Arguments, C-Strings

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";

Lecture 8 - Image Processing

Done on your VM.

Lecture 9 - Pointers

Lecture 10 - More Pointers

Lecture 11