Introduction to Arrays in C++ (one-dimensional array)

preview_player
Показать описание
In this lecture, you will learn:
1. Array declaration & initialization
2. Array elements vs. indices
3. Accessing array elements
4. Program Examples:
- Displaying array elements using for loop
- Displaying array elements using range-based for loop
- How to calculate array size
- Taking inputs from the user and store them in an array
- Find the summation of array elements
- Find the average of array elements
- Find the largest element from an array
- Find the smallest element from an array
-----------------------------------------------------------------------------------------
If this lecture deserves your like please subscribe.
-----------------------------------------------------------------------------------------
Рекомендации по теме
Комментарии
Автор

This video help me lots.
Thank You Sir😇

AbrarHasan-bdrn
Автор

Sir alhamdulellah vloo e bujtee parchii .. thank you sir ❤️❤️

mdazizulhakim
Автор

Waiting a long time for this video. Your videos help a lot to learn to my study. Thank you so much sir...

A_SaimaChowdhury
Автор

স্যার ফর ইচ লুপ নিয়ে আরেকটু বিস্তারিত জানালে ভালো হতো মনে হয়।

mehedihasannayem
Автор

#include<iostream>
#include<math.h>
#include<string>
using namespace std;



int main(){

double arr[] = {2, 6, 1, 9, 7, 6, -9, 10, 1}, sum=0, avg;

int arrMemorysiZe = sizeof(arr);

int arrSize = arrMemorysiZe / sizeof(arr[0]);

cout<<"array memory size = "<<arrMemorysiZe<<endl;
cout<<"array size = "<<arrSize<<endl;

for(int i=0;i<arrSize;i++){
sum = sum+arr[i];
}

avg = sum/arrSize;

cout<<"sumattion = "<<sum<<endl;
cout<<"avarage = "<<avg<<endl;



return 0;

}

Orbit_bd
Автор

#include<iostream>
#include<math.h>
#include<string>
using namespace std;



int main(){

int arr[6], sum=0, avg, max, min;




cout<<"enter array elements = ";
for(int i=0;i<6;i++){
cin>>arr[i];
}

max = arr[0];
min = arr[0];

for(int i=0;i<6;i++){
sum = sum+arr[i];
}

for(int i=1;i<6;i++){
if(min>arr[i]){
min = arr[i];
}
}

cout<<"min number = "<<min;



return 0;
}

Orbit_bd
join shbcf.ru