Programming Assignment #4 CS-2301, B-Term 20091 Programming Project #4 Arrays and Pointers Due, November 24, 11:59 PM (Assignment adapted from C: How to.

Slides:



Advertisements
Similar presentations
Question Bank. Explain the syntax of if else statement? Define Union Define global and local variables with example Concept of recursion with example.
Advertisements

Linked Lists in C and C++ CS-2303, C-Term Linked Lists in C and C++ CS-2303 System Programming Concepts (Slides include materials from The C Programming.
An introduction to pointers in c
Module R2 CS450. Next Week R1 is due next Friday ▫Bring manuals in a binder - make sure to have a cover page with group number, module, and date. You.
Lab 8 printf() modular arithmetic how to read assignments
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 16 – Craps Game Application Introducing Random-Number.
Page 1 of 26 Javascript/Jscript Ch 7,8,9,10 Vadim Parizher Computer Science Department California State University, Northridge Spring 2003 Slides from.
A Java API Package java.security  The Java Security Package contains classes and interfaces that are required by many Java programs.  This package is.
Linked Lists in C and C++ CS-2303, C-Term Linked Lists in C and C++ CS-2303 System Programming Concepts (Slides include materials from The C Programming.
MATH CLASH Integer Addition Game 1. Player Rules Players must be paired with another person Cards must be evenly divided at the start of the round Players.
Chapter 5 C Functions The best way to develop and maintain a large program is to divide it into several smaller program modules, each of which is more.
Example – calculating interest until the amount doubles using a for loop: will calculate up to 1000 years, if necessary if condition decides when to terminate.
Strings and Dynamic Memory Allocation CS-2301, B-Term Programming Assignment #6 Strings and Dynamic Memory Allocation CS-2301, System Programming.
Programming Assignment #3 CS-2301, B-Term Programming Assignment #3 User-defined Functions Due, November 18, 11:59 PM (Assignment adapted from C:
Programming Assignment #6 CS-2301 D-term Programming Assignment #6 Binary Trees CS-2301 System Programming D-term 2009 (Slides include materials.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 5 - Functions Outline 5.1Introduction 5.2Program.
Review of Exam #2CS-2301, B-Term Review of Exam #2 CS-2301, System Programming for Non-Majors (Slides include materials from The C Programming Language,
Arrays Hanly - Chapter 7 Friedman-Koffman - Chapter 9.
Project 1CS-3013 A-term Programming Project #1 Forking Processes Due Tuesday, September 8, 11:59 PM.
©2004 Brooks/Cole Chapter 8 Arrays. Figures ©2004 Brooks/Cole CS 119: Intro to JavaFall 2005 Sometimes we have lists of data values that all need to be.
 2007 Pearson Education, Inc. All rights reserved C Functions.
Homework #5, Binary Trees CS-2301 B-term Homework #5 Binary Trees CS-2301, System Programming for Non-majors (Slides include materials from The C.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 12 – Craps Game Application: Introducing Random.
C Lecture Notes Functions (Cont...). C Lecture Notes 5.8Calling Functions: Call by Value and Call by Reference Used when invoking functions Call by value.
1 CSCE 1030 Computer Science 1 Arrays Chapter 7 in Small Java.
Binomial Distributions. Binomial Experiments Have a fixed number of trials Each trial has tow possible outcomes The trials are independent The probability.
Binary TreesCS-2301, B-Term Programming Assignment #5 Binary Trees CS-2301, System Programming for Non-Majors (Slides include materials from The.
IntroductionCS-3013 C-term Programming Project #1 Forking Processes Due Thursday, January 24, 6:00 PM.
Assignment #2, 12- month Calendar CS-2301, B-Term Programming Assignment #2 12-Month Calendar CS-2301, System Programming for Non-Majors (Slides.
Data Structures — Lists and Trees CS-2301, B-Term Data Structures — Lists and Trees CS-2301, System Programming for Non-Majors (Slides include materials.
Check it out! : Simple Random Sampling. Players of a dice game roll five dice and earn points according to the combinations of numbers they roll.
Warm up: Solve each system (any method). W-up 11/4 1) Cars are being produced by two factories, factory 1 produces twice as many cars (better management)
Craps!. Example: A Game of Chance Craps simulator Rules – Roll two dice 7 or 11 on first throw, player wins 2, 3, or 12 on first throw, player loses 4,
The possible outcomes are 2 + 2, 2 + 3, 2 + 4, 3 + 2, 3 + 3, 3 + 4, 4 + 2, 4 + 3, The probability of an even sum is ____. The probability of an.
1 Lecture 3 Part 1 Functions with math and randomness.
 2004 Prentice Hall, Inc. All rights reserved. 1 Chapter 11 - JavaScript: Arrays Outline 11.1 Introduction 11.2 Arrays 11.3 Declaring and Allocating Arrays.
Estimating Probabilities by Collecting Data
Chapter 4 Probability Distributions
Project 1, Command Shell CS-502 (EMC) Fall Programming Project #1 Command Shell CS-502, Operating Systems EMC, Fall 2009 (Slides include materials.
Arrays- Part 2 Spring 2013Programming and Data Structure1.
Your First Data Structure: 1D Array Shirley Moore CS 1401 Spring 2013 cs1401spring2013.pbworks.com April 9-11, 2013.
Array Cs212: DataStructures Lab 2. Array Group of contiguous memory locations Each memory location has same name Each memory location has same type a.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 17 – Flag Quiz Application Introducing One-Dimensional.
Function Problems. Write Functions Asks users whether the user wants to continue of not, then returns the answer. Takes two integers and returns 1 if.
CSC 162 Visual Basic I Programming. Array Parameters and Sorting Array Parameters –Entire Arrays –Individual Elements Sorting –Bubble Sort.
 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 6 - Functions.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Functions (Header files and Library Functions) Outline.
MM1D2d: Use expected value to predict outcomes
Simulating Experiments on the TI Section Starter Use the random integer generator in your calculator to choose an SRS of 5 students from.
Chapter 6 Methods: A Deeper Look. Objectives In this chapter you will learn: How static methods and fields are associated with an entire class rather.
6.5 Find Expected Value MM1D2d: Use expected value to predict outcomes. Unit 4: The Chance of Winning!
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Craps Game Application Introducing Random-Number Generation and Enum.
 2000 Prentice Hall, Inc. All rights reserved. 5.2Program Modules in C Functions –Modules in C –Programs combine user-defined functions with library functions.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 16 – Craps Game Application Introducing Random-Number.
Arrays. Topics to be Covered... Arrays ◦ Declaration ◦ Assigning values ◦ Array manipulation using loops Multi-dimensional arrays ◦ 2D arrays ◦ Declaration.
Find Expected Value.  A collection of outcomes is partitioned into n events, no two of which have any outcomes in common. The probabilities of n events.
 2000 Prentice Hall, Inc. All rights reserved Introduction Divide and conquer –Construct a program from smaller pieces or components –Each piece.
Introduction to Files Intro to Computer Science CS1510, Section 2 Dr. Sarah Diesburg 1.
C++ for Engineers and Scientists Second Edition Chapter 12 Pointers.
Makefiles and Notes on Programming Assignment PA2
Intro to Computer Science CS1510 Dr. Sarah Diesburg
Exam 1 Material Study Guide
Linked Lists in C and C++
Programming Project #1 Command Shell
Programming Assignment #6
Programming Assignment #5
Programming Project #1 Fork and Command Shell
Single-Blind Taste Test
Review Lab assignments Homework #3
Functions in C Math Library Functions Functions Function Definitions
Presentation transcript:

Programming Assignment #4 CS-2301, B-Term Programming Project #4 Arrays and Pointers Due, November 24, 11:59 PM (Assignment adapted from C: How to Program, 5 th and 6 th editions, by Deitel and Deitel) Heads up:– Project is due on Tuesday before Thanksgiving break!

Programming Assignment #4 CS-2301, B-Term Objectives Create and allocate arrays of data Pass arrays as arguments to functions Allow functions to modify the contents of arrays Use pointer arithmetic for arrays See handout (.doc,.html)dochtml

Programming Assignment #4 CS-2301, B-Term Assignment Copy playGame, rollDice from Project #3. Modify playGame as follows:– Do not print anything Return an integer indicating number of throws of this game –Positive if player wins, negative if player loses Add additional functions in separate.c file Play a number of games and store results in an array Print mean and median number of throws per game Analyze the results and print table showing results Multiple modules (.c files) with makefile

Programming Assignment #4 CS-2301, B-Term Program Operating Prompt for number of games to play Allocate an array with that number of elements Play the games, gather results in array Calculate and print mean and median number of throws per game Calculate and print the following:– Probability of the player winning at craps Percent won on 1 st throw, 2 nd throw, etc. (up to 20) Percent lost on 1 st throw, 2 nd throw, etc. (up to 20) Do chances of winning improve with number of throws

Programming Assignment #4 CS-2301, B-Term Calculating Median Median – the middle value of all the results Store data in array Sort by value Select the middle value See handout for formula Sorting the data Use BubbleSort — see handout

Programming Assignment #4 CS-2301, B-Term Makefile Your program must comprise at least two.c files and one.h file. Recommend three and two One each for bubblesort.c and bubblesort.h Must include a makefile To build entire project To build an individual.o file To clean the directory See Lab #4

Programming Assignment #4 CS-2301, B-Term Grading Total 25 points Program organization & makefile – 5 points Correct compilation without warnings – 2 points Correctly allocating and freeing array, playing n games, and storing results Sorting array, calculating mean and median Building table or data structure and answering four questions – 5 points Write-up – 3 points Extra credit – 5 points Use optional command line arguments for number of games and random number seed — see handout

Programming Assignment #4 CS-2301, B-Term Questions?