Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 117 Spring 2002 April 5, 2002. Exam 3 April 10 –files, arrays, strings, classes –practice exams are up –review on Monday.

Similar presentations


Presentation on theme: "CS 117 Spring 2002 April 5, 2002. Exam 3 April 10 –files, arrays, strings, classes –practice exams are up –review on Monday."— Presentation transcript:

1 CS 117 Spring 2002 April 5, 2002

2 Exam 3 April 10 –files, arrays, strings, classes –practice exams are up –review on Monday

3 Random numbers use the rand function from stdlib.h –int rand() returns an integer from 0 to RAND_MAX (a big number) –the sequence you get is always the same use % to get numbers from 1 to 6 dieValue = 1 + rand() % 6;

4 randomizing dice #include at the top of your main function srand( time( NULL)); See testFns for an example

5 yahtzee NOW DUE: April 12 you may write a single player game (since my Player class doesn't seem to be getting written) input and output format are up to you this time –please explain the input required of the user in your readme

6 static members functions and variables belong to the class as a whole rather than a specific instance use them with className:: in front of the name (object reference will also work)

7 Common Programming Errors Not defining a function as a member of a class Referencing a private attribute of a class Missing header files Missing ; on class definition

8 Common Programming Errors Mismatch in signature between header and function definitions Prefixing a class function call –obj.function(); –don't use class name except for static functions trying to access instance variables from a static function


Download ppt "CS 117 Spring 2002 April 5, 2002. Exam 3 April 10 –files, arrays, strings, classes –practice exams are up –review on Monday."

Similar presentations


Ads by Google