EE355 Spring 2017 Just another USC Bits site

EE355 Spring 2017: Just another USC Bits site


Jump to last lecture


Lecture 2

Overflow and Assignment


Conditionals (if..else)

Lecture 3

Loops 1

Here is a step-by-step visualization of a for loop's execution.

Note, there are several common ways to increment the loop variable:

Here's an example using Newton's Method to calculate the square root of a number.

Loops 2

Random Number Generation

Common Loop Tasks: Search and/or Selection

Common Loop Tasks: Aggregation

Lecture 4


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


Array Challenge Problem 1

Array Challenge Problem 2: Secret Sequence Game

Write a game program that will generate a secret sequence of 4 random numbers between 1 and 3.
Then allow the user up to 8 turns to guess the correct sequence of 4 numbers.
(taking in 4 values each turn separated by spaces). After each guess follow the procedure below:


Lecture 5

More Arrays, Passing Arrays as Arguments, C-Strings

Example 1

This code has a bug (it's not in the initializer). It will print out false no matter what password you type in. Why?

int secret_password[4] = {2, 0, 1, 4};
int input[4];
cout << "Please enter your password, one digit per line.";
cin >> input[0] >> input[1] >> input[2] >> input[3]; 
if (input == secret_password)
   cout << "Access granted!";

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 6 - More Pointers

Lecture 7 - Dynamic Memory

Lecture 8 - Objects (Strings and Structs)

C++ Strings


Lecture 9 - Classes

Lecture 10 - Image Processing

Done on your VM.

Lecture 11 - Complexity Analysis

Lecture 12 - Recursion

Lecture 13

Lecture 14

Lecture 15

Lecture 16

Lecture 18

Lecture 21

Lecture 23

Lecture 24

Leave a Reply

Recent Posts

Recent Comments