Содержание
- 2. Multiple-Subscripted Arrays Multiple subscripts a[ i ][ j ] Tables with rows and columns Specify row,
- 3. Multiple-Subscripted Arrays To initialize Default of 0 Initializers grouped by row in braces int b[ 2
- 4. Multiple-Subscripted Arrays Referenced like normal cout Outputs 0 Cannot reference using commas cout Syntax error
- 5. 1 // Fig. 3.22: fig04_22.cpp 2 // Initializing multidimensional arrays. 3 #include 4 5 using std::cout;
- 6. 28 29 // function to output array with two rows and three columns 30 void printArray(
- 7. Multiple-Subscripted Arrays Next: program showing initialization After, program to keep track of students grades Multiple-subscripted array
- 8. 1 // Fig. 3.23: fig04_23.cpp 2 // Double-subscripted array example. 3 #include 4 5 using std::cout;
- 9. 24 int main() 25 { 26 // initialize student grades for three students (rows) 27 int
- 10. 44 // calculate average grade for each student 45 for ( int person = 0; person
- 11. 70 71 // find maximum grade 72 int maximum( int grades[][ exams ], int pupils, int
- 12. 87 // determine average grade for particular student 88 double average( int setOfGrades[], int tests )
- 13. 99 100 // Print the array 101 void printArray( int grades[][ exams ], int pupils, int
- 14. The array is: [0] [1] [2] [3] studentGrades[0] 77 68 86 73 studentGrades[1] 96 87 89
- 15. “Well, I’ll eat it,” said Alice, “and if it makes me grow larger, I can reach
- 16. VECTORS Array cannot change the length Vector the same purpose as arrays except can change length
- 17. Vectors Library: #include Declaration: vector name; Example: vector v; vector v(10);
- 18. Vectors To add an element to a vector for the first time, you normally use the
- 19. Vectors The number of elements in a vector is called the size of the vector. The
- 20. // Demonstrating C++ Standard Library class template vector.
- 25. Two / Three / Multi Dimensioned arrays using vector A two dimensional array is a vector
- 26. Loop by index: 0 1 10 11 20 21
- 27. Two / Three / Multi Dimensioned arrays using vector A three dimensional vector would be declared
- 29. Quiz 1. What is vector? Benefits of vector over array. Difference between array and vector. Which
- 31. Скачать презентацию