C++ Tutorial - 22 - Structures

  Рет қаралды 359,169

thenewboston

thenewboston

Күн бұрын

Пікірлер: 308
@mildlymaliciousbanana2700
@mildlymaliciousbanana2700 5 жыл бұрын
HI Bucky I know you're never going to see this but thank you for helping me. My father decided to tutor me in programming when I was 9 and I found your videos, so we started to use them. even now I still watch them, you've been such a big part of my life, so thank you.
@riteshyeddu
@riteshyeddu 3 жыл бұрын
@@II_xD_II 1357gu 246ddh 23457a
@riteshyeddu
@riteshyeddu 3 жыл бұрын
eggag32 : O Orz
@hetaeramancer
@hetaeramancer 3 жыл бұрын
very inspiring! where you from? what country?
@colbyNcheese
@colbyNcheese 10 жыл бұрын
I really appreciate all these videos man. I'm more of a hands on or watcher learner and this beats the hell out of reading from a boring book all day. Thanks a lot and keep up the good work.
@kevinaugustine
@kevinaugustine 16 жыл бұрын
Thanks much, Your tutorials are extraordinarily helpful for me. I am trying to navigate my way through my self taught program to learn about computers and coding- your tutorials of C++ and How to Build a Computer are greatly appreciated. I am indebted for your efforts, Kevin Walsh Chicago Peak Oil
@HarbingerBittmann
@HarbingerBittmann 11 жыл бұрын
So structures aren't the gigantic mess of things the prof made them out to be? -.- Subbed. Thank you.
@riteshyeddu
@riteshyeddu 3 жыл бұрын
Haha
@WhatTheFlipOfficial
@WhatTheFlipOfficial 3 жыл бұрын
This got me through university almost 10 years ago and it resurfaced today
@jeevanalexen
@jeevanalexen 3 жыл бұрын
that must have been quite a feeling
@isaiahryman3470
@isaiahryman3470 5 жыл бұрын
Bucky, your vids have helped me so much dude. I know its 10 years old, but thanks for all of your tutorials. You're a life saver. Also I've never run into issues with your syntax and my CSCI professors are very picky. (Thanks * 1,000)
@GregAllison
@GregAllison Жыл бұрын
3:22 As a Greg, I felt this personally.
@175griffin
@175griffin 8 жыл бұрын
I don't like your curly brackets.
@jthardee92
@jthardee92 6 жыл бұрын
Griffin okay that's what i thought but it goes so much deeper, the main function isn't indented but the closing curly bracket still is, some of the tabs are 8 spaces and some of the tabs are 10 spaces. I mean honestly the more you look at it the more fucked up it is. I cannot get over this formatting lol
@freematrix6368
@freematrix6368 10 жыл бұрын
Dear Bucky, I am 14 years old. For the past 2 years I researched about c++ but never found any good tutorials, I can't even find a compiler but when I watched your videos everything changed. Thank you.
@freematrix6368
@freematrix6368 10 жыл бұрын
Hahaha it's been 5 months and I made an RPG game with full 3d graphics without even buying a book, I can learn with this I am not stupid in fact I learned 70% of my knowledge by myself and 15% from my school and the rest from my family and other stuff.
@acerider4660
@acerider4660 10 жыл бұрын
Free Matrix Man shut up. Making what you just said is near impossible by one man.Especially by a 14 year old in 4 months.
@freematrix6368
@freematrix6368 10 жыл бұрын
Ace Rider I'm not a one man team, I've built a home-based studio with 5 of my friends.
@blipboop2763
@blipboop2763 9 жыл бұрын
+Free Matrix Hey leave him alone! He lost his compiler!
@vitya5731
@vitya5731 9 жыл бұрын
+Ace Rider It is actually possible, by copying the codes from tutorials ^^
@origamigek
@origamigek 6 жыл бұрын
speed: 1.25 = perf
@Pippy1
@Pippy1 4 жыл бұрын
That goes for just about every tutorial
@Dark_Peace
@Dark_Peace 3 жыл бұрын
1.5 for me
@kevinramirez4344
@kevinramirez4344 3 жыл бұрын
Man this help me a lot I was having a bad time trying to understand structures, but you made it in an easy way dude. !!!!
@ahmedgamberli2250
@ahmedgamberli2250 2 жыл бұрын
I wasn't even born when you made this video! Btw, thanks for the video.
@AlertFrench
@AlertFrench 7 жыл бұрын
man hearing your voice makes me happy and relax and it's about time to earn the knowledge i want , by finishing your video
@frederickgrobler6904
@frederickgrobler6904 7 жыл бұрын
mohammad abu sneneh I
@1987Rlee
@1987Rlee 6 жыл бұрын
I'm so grateful for these videos. This guy is getting me through school. My C++ text is book is a piece of garbage. I would be so dead and failing if I hadn't found TheNewBoston. Thanks Bucky.
@jalalhamza1344
@jalalhamza1344 2 жыл бұрын
alright 13years and still the best vid on structures
@papano12
@papano12 15 жыл бұрын
No, you explained it correctly. Yeah I'm getting really into C++. Thanks for helping.
@thissvans
@thissvans Жыл бұрын
Watching this 14years later
@dezeya4242564
@dezeya4242564 7 жыл бұрын
Honestly the best tutorials on the internet
@Ajcav763
@Ajcav763 12 жыл бұрын
20 is just a number that allows the string to go up to(in characters)
@TheBeresford7
@TheBeresford7 13 жыл бұрын
@JoelakaDamian there is its called general practice keeping the code efficient and clean
@Patsfan33
@Patsfan33 6 жыл бұрын
This video was a life saver. THANK YOU
@Flowlance
@Flowlance 14 жыл бұрын
Good guide. why is there a semicolon after the curly brackets for structures?
@tarirocoffee5026
@tarirocoffee5026 2 жыл бұрын
Bucky Roberts??? Just bumped into this tutorial, once did javascript with you. Best tuts!
@napsy12345
@napsy12345 15 жыл бұрын
A structure is not a variable to store similar information. It's a collection of a group of variables. A structures has a symbolic name but it's not a data type but a way to handle different variables more conveniently.
@inuyaxxa
@inuyaxxa 11 жыл бұрын
Hi guys, maybe its a dumb question... but why: char name[20]; and not string name;
@kareemayman1926
@kareemayman1926 5 жыл бұрын
for string you need to add library cstring
@m_t_t_
@m_t_t_ 4 жыл бұрын
@@kareemayman1926 so add it then
@shanewalsch
@shanewalsch 4 жыл бұрын
chars take less space
@thataverageplayer5680
@thataverageplayer5680 3 жыл бұрын
@@m_t_t_ it's a waste of overhead. You are making your program do more work than necessary.
@m_t_t_
@m_t_t_ 3 жыл бұрын
@@thataverageplayer5680 but you are making it easier to work with. Plus it will slow your program down by less than a millisecond so it won’t even be noticeable.
@LumpyKorn
@LumpyKorn 14 жыл бұрын
@archaniel99x int is for numbers only while a char is a letter such as "a, b, or z". The brackets that he uses is to show that it is an array of the type char. This means that there will be a series of chars being used such as "mike". The number 20 means that the maximum array length is 20 so he would be able to enter a name with up to 20 chars. If he made it char name[3] you would only be able to use 3 letters such a "Dan".
@crok042000
@crok042000 15 жыл бұрын
wow i was confused about this but after studying your video i got the hang of it thanks..... you should be a college professor
@SalmondKeyStudios
@SalmondKeyStudios 13 жыл бұрын
@SteakOfAnger A char variable, by itself, only stores 1 character. He needs a character array to store the full name, though I don't see why he just doesn't use a String.
@NickFallsFromTheRoof
@NickFallsFromTheRoof 3 жыл бұрын
bucky my guy you rock.
@RescueLoL
@RescueLoL 14 жыл бұрын
@dmdrummer23 as you may noticed, the struct is the pre-version of a class, concrete said a very simple class with only public attributes and no methods. as i can say of my experience in developing applications i've only seen structs in performance applications where not much information overhead is needed but where code modularity is necessary because of code complexity. of course you can develop OO in c++ like in Java. hope this answer helped you a bit ;) happy developing!
@MeneerJK
@MeneerJK 15 жыл бұрын
he says hello everybody welcome to your FIRST toturial, but we're at 22 lol
@jrgalioto
@jrgalioto 7 жыл бұрын
Cramming for a final. Thanks for your help.
@jaredthecoder
@jaredthecoder 12 жыл бұрын
I thought it was a semi-rhetoric question but no, essentially your not wrong.
@nurnajihah492
@nurnajihah492 3 жыл бұрын
Thank you so much...now I know how to use structure!
@kaal4143
@kaal4143 2 жыл бұрын
How use structure...?
@1415gatewayable
@1415gatewayable 12 жыл бұрын
:0 mind blow... i actually understood, do you have a channel?
@Patrico2k6
@Patrico2k6 14 жыл бұрын
great Job, You made it so simple and easy to understand .. thx
@triptomoon9870
@triptomoon9870 4 жыл бұрын
What's the difference between a structure & a class?
@mhcomputeracademy
@mhcomputeracademy 4 жыл бұрын
kzbin.info/www/bejne/q3iqp2WviJh8hZY
@Yizak
@Yizak 13 жыл бұрын
@SteakOfAnger char name[20] is an array of chars. He's using that to stick a load of characters together and form a name. :)
@carlanthem
@carlanthem 7 жыл бұрын
Very well explained. Thanks so much💪✌
@2testtest2
@2testtest2 15 жыл бұрын
If you have not figured it out yet, the last character needs to be a NULL character (often written \0 in text) so that the computer knows that the string ends there
@uzairriaz8632
@uzairriaz8632 6 жыл бұрын
Awesome Bro,You Know how to teach Well.
@georgemendez6760
@georgemendez6760 5 жыл бұрын
Bucky you amazing person!
@awsomguitarman
@awsomguitarman 14 жыл бұрын
they should give me my degree just for watching your vids. they are so helpful
@zhir96
@zhir96 13 жыл бұрын
thank you so much thenewboston you just make it so easy and fun to do :) thanks!!!!!!!!!!!!
@computerfis
@computerfis 14 жыл бұрын
@golfguy777 You don't have to you can always put the "using namespace std" thing up there with the #include.... JUST make sure that the "using namespace std" is mentioned before you use cout and cin!
@pippoMASO
@pippoMASO 14 жыл бұрын
@DrAsTiK777 Because it's a const char, which is not supposed to be modified within the program. Strings are useful when you are supposed to modify them. I'm from Italy, I hope it's clear what I tried to tell you
@zwigoda1
@zwigoda1 11 жыл бұрын
is this the same syntax as visual studio 2010~2012 compilers? cause the way you filled the data to the newPerson bucky, was a bit diffrent than what i have seen. ohh and thanks so much for these and the python clips
@Alonsoman4000
@Alonsoman4000 8 жыл бұрын
Nice tutorial buddy, it helped me a lot!
@sidrocksinthisworld
@sidrocksinthisworld 12 жыл бұрын
when you declared the different variables associated with the structure eg. name and age, why did you use the variable name are the array but not the age? thanks for the tuts helping me a lot!
@totasalam7060
@totasalam7060 10 жыл бұрын
i really liked this video thank you very much
@annihilationwave
@annihilationwave 14 жыл бұрын
huh is this tutorial still my first. have i been dreaming all day
@laserbeak43
@laserbeak43 15 жыл бұрын
thanks for the refresher
@ivyb1454
@ivyb1454 8 жыл бұрын
what about i wanna make a program using structure but i will let the user input the information?
@kishoregorijavolu1099
@kishoregorijavolu1099 8 жыл бұрын
Explained so well....
@dmdrummer23
@dmdrummer23 14 жыл бұрын
I'm just starting to learn object oriented programming and Java, and I'm wondering : are there any specific times it would be better to use a structure instead of object? Or is struct just for smaller applications? -thanks
@papano12
@papano12 15 жыл бұрын
What is the difference between a struct and a class? They seem to have the same meaning.
@BROTHA_BLACK
@BROTHA_BLACK 7 жыл бұрын
is it possible to use if statements with a struct
@mateface1313
@mateface1313 7 жыл бұрын
Yes it is, you can write for example: if(newperson.age < 18) { cout
@BROTHA_BLACK
@BROTHA_BLACK 7 жыл бұрын
MateFace Thanks man you are a life saver!
@mateface1313
@mateface1313 7 жыл бұрын
actually it would be like this! if(hoss.age < 18) { cout
@thcbri
@thcbri 13 жыл бұрын
@CheeseToastHax You are right it is a variable with a limit of 20 characters
@CheeseToastHax
@CheeseToastHax 13 жыл бұрын
@KamelineEinbein im not 100% sure but char is character which is 1 character and maybe the 20 makes it a limit of 20 characters.
@papano12
@papano12 15 жыл бұрын
I understand this now, But What is the difference between Putting char name[20] and char name[67] , What effect does the number inside have on the program?
@archaniel99x
@archaniel99x 14 жыл бұрын
nice tut very helpful but i dont get 1 thing why put char name 20 why not put just int name? and why put that number 20 in brackets what it does?
@golfguy777
@golfguy777 14 жыл бұрын
I know the program worked, but do you put the using namespace std line in the main function?
@asterix1124
@asterix1124 12 жыл бұрын
char name[20] just means that there can be 20 elements in that array called "name" it can be any number you want.. but if you put it as 10 but have more elements entered it wouldn't work.. that's why when you tried it with 1 it didn't work because you entered more elements than you asked for... when you put in char name [1] but then entered gatewayable it wouldn't work because "gatewayable" has 11 characters when you declared that the array name can only have 1 character :)
@JamesRCoston
@JamesRCoston 15 жыл бұрын
Hello thenewboston! Are structures simular to Classes?
@TheFierceGaming
@TheFierceGaming 14 жыл бұрын
Great tutorial!! I used this seed(tutorial) you gave me and made a tree(menu)!
@lawenvy2388
@lawenvy2388 5 жыл бұрын
How if i swap the char name[20] into string data type instead, will it affect the program?
@mhcomputeracademy
@mhcomputeracademy 4 жыл бұрын
kzbin.info/www/bejne/q3iqp2WviJh8hZY
@MrBrightSide622
@MrBrightSide622 15 жыл бұрын
Just askin but why do u put "[20]" after "char name"? I've watched the past tutorials of C++ but I don't remember anything about putting a number after a character. (char)
@HaZaRdxScopeZ
@HaZaRdxScopeZ 14 жыл бұрын
whats the difference between this and class?
@OfficialOceaneMusic
@OfficialOceaneMusic 6 жыл бұрын
What's the benefits/difference between having using namespace std in the main versus right underneath #include?
@SplinteredChaos
@SplinteredChaos 11 жыл бұрын
Can't find the source code on your website. The tutorial number is incorrect. I tried searching for struct at the tag line and came up empty.
@Oreoboy101
@Oreoboy101 15 жыл бұрын
whats the difference between classes and structures?
@premlatasuman3218
@premlatasuman3218 5 жыл бұрын
4:51 why is bucky in inverted commas but 21 is not ??
@carlisleee_
@carlisleee_ 5 жыл бұрын
it's because of the data type. A char with a size of 20 can be put in double quotes. An integer does not need quotes as the ide can figure out that it is an integer by being a whole number.
@Tashi0106
@Tashi0106 15 жыл бұрын
Is that a char array filled with a string?
@supersayianz
@supersayianz 14 жыл бұрын
I have a question: wat if I am only allowed to use class instead of structures? Can it be still used?
@LoganRWeber
@LoganRWeber 13 жыл бұрын
I've heard you say his name in the java tutorials so, who is Hoss?
@BigletJohnson
@BigletJohnson 12 жыл бұрын
the number refers to the length of the char list
@Olemassacre
@Olemassacre 13 жыл бұрын
How can I use structures with the cin >> command?
@dmdrummer23
@dmdrummer23 14 жыл бұрын
@RescueLoL alright, so i guess a struct is like a compromise between an object in a class, and a function? Thanks a lot!
@khalsa403
@khalsa403 10 жыл бұрын
hey bucky i tried the program with strings instead of char and it wouldnt work...any idea why?
@mbccq
@mbccq 13 жыл бұрын
is using char name[] allowable because char only can allow to store one character
@kateyy8800
@kateyy8800 3 жыл бұрын
how about using do while loop with this program?
@zyafi123
@zyafi123 12 жыл бұрын
when i tried to cout hoss's name, i only got hoss not hoss jones, how do you cout more than one word??? helpp?????
@nithishvicraman6498
@nithishvicraman6498 7 жыл бұрын
Thanks bro this is really useful
@abhishekraol4905
@abhishekraol4905 11 жыл бұрын
What's the system("pause"); at the end for?
@souljarohill8795
@souljarohill8795 2 жыл бұрын
structs are basically like classes
@riseandrule
@riseandrule 12 жыл бұрын
Am I wrong if I think this looks more like creating your own Class in JAVA?
@KingTut.
@KingTut. 2 жыл бұрын
why did you use CHAR instead of STRING for name?
@jcsmith115
@jcsmith115 12 жыл бұрын
Also when you use a struct object like bucky it becomes the type of the object variable you use. So bucky.age is an int and you can treat it as one. So bucky.age + bucky.age = 42
@valizeth4073
@valizeth4073 6 жыл бұрын
So a struct is a mini class?
@parkerbiskup8458
@parkerbiskup8458 6 жыл бұрын
Vali Zeth no, the real difference is the private and public restrictions on the members
@vxern2443
@vxern2443 7 жыл бұрын
Good tutorial but your code is messy af
@DanielHauser
@DanielHauser 13 жыл бұрын
@nishadaboobacker Not really, Windows is written mostly in C :P
@nagendrra6609
@nagendrra6609 9 жыл бұрын
awsome tutorial thank you man =D
@jony1710
@jony1710 14 жыл бұрын
can i make arrays from the new data type that i make form my structure eg: struct newperson {int age; char name; }; and then in the main: newperon = person [5]; then I can save an array for 5 people using that structure? it doesn't seam to work for me.
@Hwyadylaw
@Hwyadylaw 12 жыл бұрын
He uses it as examples. This will be useful late for other things.
@Brixpascito
@Brixpascito 8 жыл бұрын
is there a way to pass a structure on a function I'm having a hard time for making a code like those
@alchemitch
@alchemitch 15 жыл бұрын
when you declare a char with say [20] all that does is tells the computer that you want to have 19 spaces to put a name into (the extra space is used by the computer). i hope that helps :P
@amyo
@amyo 6 жыл бұрын
Bucky for president
@iZenic
@iZenic 14 жыл бұрын
****************HELP PLEASE ANSWER******************* I dont understand (at 2:10 ) what the "20" is for after the "char name" I went back to your tutorials but i couldn't find anything. PLEASE ANSWER.
@hendrixansel9750
@hendrixansel9750 7 жыл бұрын
what's the difference between structures and classes?
@mrtz5684
@mrtz5684 6 жыл бұрын
Efdf Fsdfsd thats about public and private
@Marty70072
@Marty70072 12 жыл бұрын
How come I dont see the source codes at your site? D: HELP!!!
C++ Tutorial - 23 - Writing on Files
6:42
thenewboston
Рет қаралды 166 М.
struct Basics | C Programming Tutorial
24:44
Portfolio Courses
Рет қаралды 160 М.
I Sent a Subscriber to Disneyland
0:27
MrBeast
Рет қаралды 104 МЛН
you will never ask about pointers again after watching this video
8:03
Learn C++ With Me #20 - Functions
26:14
Tech With Tim
Рет қаралды 60 М.
Writing Code That Runs FAST on a GPU
15:32
Low Level
Рет қаралды 576 М.
STRUCTS in C++ explained 🏗️
5:01
Bro Code
Рет қаралды 37 М.
Structs - C++ Tutorial For Beginners #23
8:48
NeuralNine
Рет қаралды 36 М.
C++ Header Files
15:10
The Cherno
Рет қаралды 746 М.
File Handling in C++ Programming
16:06
Simple Snippets
Рет қаралды 376 М.
I Sent a Subscriber to Disneyland
0:27
MrBeast
Рет қаралды 104 МЛН