Recommended
PPTX
PDF
Chapter12 array-single-dimension
PPTX
PPTX
C_Arrays(3)bzxhgvxgxg.xhjvxugvxuxuxuxvxugvx.pptx
PPTX
PPT
PPT
its arrays ppt for first year students .
PPTX
Array In C++ programming object oriented programming
PPT
Computer Programming- Lecture 8
PDF
PPTX
ppt on arrays in c programming language.pptx
PPT
PF Lecture 9.ppt hakakbshisokwb jaiksnsjomabhj
PPT
PDF
PPTX
Array,string structures. Best presentation pptx
PPTX
Unit - 2(part-2)_pointers & references.pptx
PPTX
Unit - 2(part-1)_functions & it's Types.pptx
PPT
PPTX
PDF
11. Programming(BS-phy6)-Lecture11+12 .pdf
PPT
PPT
Lecture#8 introduction to array with examples c++
PDF
PPT
DSA Lec-2 Arrays ADT FOR THE STUDENTS OF BSCS
PPT
PPTX
C++ array notes 1 for engineering students.pptx
PPTX
Ch-11-Arrays.ppt-1.pptx eurhrbdhdbdhrhdhdh
PPT
PDF
M.Sc. Nonchordates Complete Syllabus PPT | All Important Topics Covered
PPTX
Repeat Orders_ Use Odoo Blanket Agreement
More Related Content
PPTX
PDF
Chapter12 array-single-dimension
PPTX
PPTX
C_Arrays(3)bzxhgvxgxg.xhjvxugvxuxuxuxvxugvx.pptx
PPTX
PPT
PPT
its arrays ppt for first year students .
PPTX
Array In C++ programming object oriented programming
Similar to Array_C++_programming_example_and reviews2
PPT
Computer Programming- Lecture 8
PDF
PPTX
ppt on arrays in c programming language.pptx
PPT
PF Lecture 9.ppt hakakbshisokwb jaiksnsjomabhj
PPT
PDF
PPTX
Array,string structures. Best presentation pptx
PPTX
Unit - 2(part-2)_pointers & references.pptx
PPTX
Unit - 2(part-1)_functions & it's Types.pptx
PPT
PPTX
PDF
11. Programming(BS-phy6)-Lecture11+12 .pdf
PPT
PPT
Lecture#8 introduction to array with examples c++
PDF
PPT
DSA Lec-2 Arrays ADT FOR THE STUDENTS OF BSCS
PPT
PPTX
C++ array notes 1 for engineering students.pptx
PPTX
Ch-11-Arrays.ppt-1.pptx eurhrbdhdbdhrhdhdh
PPT
Recently uploaded
PDF
M.Sc. Nonchordates Complete Syllabus PPT | All Important Topics Covered
PPTX
Repeat Orders_ Use Odoo Blanket Agreement
PPTX
Expected Revenue Report In Odoo 18 CRM
PDF
Blood Group Incompatibility: Rh Factor and Erythroblastosis Fetalis
PPTX
Pig- piggy bank in Big Data Analytics.ppt.pptx
PPTX
3 G8_Q3_L3_ (Cartoon as Representation in Opinion Editorial Article).pptx
PPTX
ATTENTION -PART 2.pptx Shilpa Hotakar for I semester BSc students
PDF
Using Charts and Tables in Presenting Data
PPTX
Access partner report in Odoo 18.2 _ Odoo 19
PPTX
Nursing Unit Management, patient care unit, physical layout of nursing unit,t...
PPTX
How to Configure Push & Pull Rule in Odoo 18 Inventory
PPTX
AN EXTREMELY BORING GENERAL QUIZ FOR UG.pptx
PPTX
REVISED DEFENSE MECHANISM / ADJUSTMENT MECHANISM-FINAL
PPTX
Partial Correlation of Coefficient - Values of r₁₂.₃, r₂₃.₁ & r₁₃.₂
PPTX
Details of Epithelial and Connective Tissue.pptx
PDF
International Men's Day Event: Breaking the Silence: Embracing Vulnerability ...
PPTX
Growth & Development MILESTONES (ADOLESCENTS ).pptx
PPTX
PURPOSIVE SAMPLING IN EDUCATIONAL RESEARCH RACHITHRA RK.pptx
PPTX
How to Create Lead_Opportunity From Odoo 18 Website
PDF
Cultivating Greatness Pune's Best Preschools and Schools.pdf
Array_C++_programming_example_and reviews2 1. 2. 3. 4. What is array? Its example in real life?
Array is an indexed sequence of elements, all the same type.
5. 6. How to declare an array?
Data type array name [size];
int array[4];
Initialize array
int array [3] = {3, 4,5};
int array[3] ;
array[0] = 3;
array[1] = 4;
array[2] =5;
Accessing array
For loop
7. 1. for(i=0;i<n;i++) {
2. for(j=i+1;j<n;j++) {
3. if(arr[i]>arr[j]) {
4. temp =arr[i];
5. arr[i]=arr[j];
6. arr[j]=temp;
7. }
8. }
9. }
1. int size = 5;
2. int array[size] = {4, 5, 1, 3, 9};
3. temp=0; int i=0;
4. int j=size- 1;
5. while( i < j){
6. temp = array[i];
7. array[i] = array[j];
8. array[j] = temp; i++;
9. j--;
10. }
Sort ascending order
1. for(i=0;i<n;i++) {
2. for(j=i+1;j<n;j++) {
3. if(arr[i]<arr[j]) {
4. temp =arr[i];
5. arr[i]=arr[j];
6. arr[j]=temp;
7. }
8. }
9. }
Sort descending order
Reverse array
8. 9. 10. Practice
what is the value of sum after this code executes?
1. int[][] matrix = {{1,1,2,2},{1,2,2,4},{1,2,3,4},{1,4,1,2}};
2. int sum = 0;
3. int col = matrix[0].length - 2;
4. for (int row = 0; row < 4; row++) {
5. sum = sum + matrix[row][col];
6. }
11. 12. Agenda
- Watch video of passing array as parameter in Function
- Review function definition and its example
- Practice problem
13. 14. 15. 16. Example
1. #include <iostream>
2. using namespace std;
3. int addition (int a, int b) {
4. int r;
5. r=a+b;
6. return r;
7. }
8. int main () {
9. int z;
10. z = addition (5,3);
11. cout << "The result is " << z;
12. }
17. 18. Practices
Write a program with function to find 3 largest number of an array.
Array size: 8
Input: {7, 12, 9, 15, 19, 32, 56, 70}