Easy Programming - Beginner C++ Tutorial - Simple Array Tutorial (16)

preview_player
Показать описание
In this tutorial, I show you some basics about using Arrays in C++. Arrays are very simple when it comes to the basics and if you know it, you can get a lot done in a shorter period of time. The video takes you through some basics as well as shows you how it works as well as how to input and output data for arrays on the screen.

I will try to make another tutorial for Arrays where I go into using multiple array variables and output everything with and without sorting. It's very interesting and I hope you get to see it soon.

I hope you enjoy the video and if you have any requests feel free to let me know. Thanks for watching and remember to subscribe!

#EasyProgramming #ProgrammingTutorial #Arrays

-----------
Рекомендации по теме
Комментарии
Автор

I am shocked this video was made 11 years ago but it helped me a lot thanks👌

hayathadia
Автор

That normally wouldn't matter for something simple as this, but what this basically does is if for example you have x = i++ (and i has a value of 2 originally), it will output x as 2 then increase the value of i to 3. If you have x = ++i, it will first increase the value of i to 3 and x will be output as 3.

So it really depends on whether you want the increment to happen before or after the fact. They are both useful.

naztronaut
Автор

@jracer876 you can set up a temporary array where you assign the values of your current array to a new position & then move them back, first set up a loop & do

temp[(i+2) % 5] = array[i]

Then set up another loop & do:

array[i] = temp[i]

So if 'i' is 3, it'll assign temp[ (3+2) % 5 ] (or temp[0]) the value of array [3] which in your case is 6. & then when it's moved back, array[0] will equal to 6 because at that point temp[i] will equal to array[i]

That's just one way of doing it.

naztronaut
Автор

hey next time u do any video please past code in ur description code. it be more help. this video is very helpful.

monkeyboiz
Автор

@Tamlyntamlyn the subscript is the index value inside the arrays. So if you have an array called Name[5]. The 5 is the subscript.

I guess I should have said something more in the video, but I just assumed everyone would know when I spoke about it in the little table I used in the middle.

naztronaut
Автор

You'd have to define the value of y before declaring the array and then it should take. If it doesn't, let me know what error you get, it'll be easier for me to diagnose.

naztronaut
Автор

@mechatronist09 well you can watch all my vids and they should be able to help you even a little.

If there are specific things you need help with, just feel free to request that type of tutorial. I'll do my best to create the video for you.

naztronaut
Автор

@nismostreet his second response indicates that he just wants to move the values within the array two positions down the array. Don't think it's the left/right alignment.

Unless I really didn't get it.

naztronaut
Автор

@jracer876 Do you mean something like this:

array[1] value is '5' (example) and you move that 5 to array[3] ? You can do that pretty easily by doing array[3] = array[5]. But if you have something more complex in mind, like ordering them from lowest to highest or vice versa, you can do that with a bubble or index sort.

naztronaut
Автор

do u have a tutorial about how to shift elements of an array to the left or right for a set number of positions?

jracer
Автор

@njoker555 I mean where you have an array like this: array{2, 4, 6, 8, 10}, and you want to shift the entire array of numbers 2 positions to the right or how ever number of spaces the user wants for it to look like this: array{8, 10, 2, 4, 6}

jracer
Автор

hello I'm back XD

I've read somewhere that you should use ++i instead of i++ in the for loop. Is it better?

omgflyingbanana
Автор

@KristenZych lol thanks. Usually I get people telling me to shut the birds up.

naztronaut
Автор

whole month has passed but i'll reply anyway:
declare two variables, one for array size that user enters and other for array itself:
int aSize;
int *array; //yes, a pointer
cin >> aSize;
array=new int(aSize);
that's it =)

TheShotus
Автор

uhm hello..can someone help me create a program that will tell the greatest number in the array and tell which array it is located in?. pls help me thanks..:)

exoshinee
Автор

he is right, he catch 3 bird(there is 3 for loop),
otherwise he need to initialize 3 time's

duwageMadusanka
Автор

@monkeyboiz1 Can't post codes in descriptions :( I have a link to my Easy Programming website in the description, go there, navigate to the tutorials page and find the tutorials you need, I have the codes posted on the site :)

The website url is also in the watermark in the video (and my profile).

naztronaut
Автор

@cunaaye00 I'm a level 3 beginner with a flamethrower ;)

But yeah, I'm no expert. I'm learning a lot of this myself and this is just how I share my knowledge. I have plenty of people in class ask me for help so I just do this for them and everybody else who needs it :)

naztronaut
Автор

i come here because next week i have final exam

harisfarhan
Автор

i fucking love this guy almost as much as i love cocain...

frankmays
join shbcf.ru