summary13 - { using namespace std; return static_cast...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
int adjust_days( int old_days); . . . vacation[number] = adjust_days(vacation[number]); void fill_up( int a[], int size) { using namespace std; cout << "Enter " << size << " numbers:" ; for ( int i = 0; i < size; i++) cin >> a[i]; size--; cout << "The last array index used is " << size << endl; } fill_up(score, 5); fill_up(time, 10); } //Uses iostream: void input_data( int a[], int last_plant_number) { using namespace std; for ( int plant_number = 1; plant_number <= last_plant_number; plant_number++) { cout << endl << "Enter production data for plant number " << plant_number << endl; get_total(a[plant_number - 1]); } } //Uses iostream: void get_total( int { using namespace std; cout << "Enter number of units produced by each department.\n" << "Append a negative number to the end of the list.\n" ; sum = 0; int next; cin >> next; while (next >= 0) { sum = sum + next; cin >> next; } cout << "Total = " << sum << endl; } void scale( int a[], int size) { for ( int index = 0; index < size; index++) a[index] = round(a[index]/1000.0); } //Uses cmath: int round( double number)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: { using namespace std; return static_cast &lt; int &gt;(floor(number + 0.5)); } //Uses iostream: void graph( const int asterisk_count, int last_plant_number) { using namespace std; cout &lt;&lt; &quot;\nUnits produced in thousands of units:\n&quot; ; for ( int plant_number = 1; plant_number &lt;= last_plant_number; plant_number++) { cout &lt;&lt; &quot;Plant #&quot; &lt;&lt; plant_number &lt;&lt; &quot; &quot; ; print_asterisks(asterisk_count[plant_number - 1]); cout &lt;&lt; endl; } } //Uses iostream: void print_asterisks( int n) { using namespace std; for ( int count = 1; count &lt;= n; count++) cout &lt;&lt; &quot;*&quot; ; } Summary Ch 10.2 Chapter 10.2 Arrays in Functions can use an array as an argument such as Array Parameter Should have arguments declaring the type of the array, the index, and the size of the array Place const before the variable declaration to ensure that the argument will not be changed Example: (expand text box to see full code)...
View Full Document

Page1 / 2

summary13 - { using namespace std; return static_cast...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online