Midterm 2 Review Quiz 09

# Iftheusersinputispyourcodeshould

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: that the struct team_record from  Problem 2b has been declared above the main program.    /* Update a team’s record after a new game. The team’s score in the new game is in the variable score, and the team’s win-loss record for that game is in the variable points */ team_record my_team; float points, score; … my_team[total_score] += score; my_team[num_wins] = points;                    (c)   /* Function sets every element of the array arr to init_value. Size = size of the array. */ int InitArray(int arr, int init_value, int size) { for (int i=0; i&lt;= size; i+1) { cout &lt;&lt; init_value; } }     Problem 4: 25 points.    Write short snippets of code to accomplish the following tasks:    (a) For an array that has been declared as    float floatArr[5][8];   write a snippet of code that computes and prints the average of all the  elements in ...
View Full Document

## This note was uploaded on 02/08/2014 for the course CS 115 taught by Professor Staff during the Fall '08 term at Sonoma.

Ask a homework question - tutors are online