#enums #enumerations Enums C++ tutorial example explained
Пікірлер: 43
@BroCodez2 жыл бұрын
#include enum Day {sunday = 0, monday = 1, tuesday = 2, wednesday = 3, thursday = 4, friday = 5, saturday = 6}; int main () { // enums = a user-defined data type that consists // of paired named-integer constants. // GREAT if you have a set of potential options Day today = friday; switch(today){ case sunday: std::cout
@higiniofuentes2551 Жыл бұрын
Thank you for this very useful video!
@higiniofuentes2551 Жыл бұрын
Is possible to create an enum variable with variables inside? Like a dynamic enum! Thank you!
@rameezalipacific Жыл бұрын
F
@DetCoAnimeFan2 жыл бұрын
Oh my, visited this channel after a while and so much new content to watch! GREAT!
@mvisperas4 ай бұрын
The one thing I found out about enums is that you cannot use an identifier that already exists. For example: enum Day {sunday = 0, monday = 1, tuesday = 2, wednesday = 3, thursday = 4, friday = 5, saturday = 6}; enum WorkDay {monday = 1, tuesday = 2, wednesday = 3, thursday = 4, friday = 5}; Even if you change monday in Workday to 0, it will not compile. Just something to remember.
@JackEvans-hf7qt Жыл бұрын
//program to display planet's info using enumeration(enums) in c++ # include using namespace std; enum planets { Mercury,Venus,Earth,Mars, Jupiter,Saturn,Uranus,Neptune }; int main() { planets planet=Mercury; switch(planet) { case Mercury: cout
@stith_pragya7 ай бұрын
Thank You So Much for this wonderful video............🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻
@kuyaminn5976 күн бұрын
//thank you for this video. enum studentType {FRESHMAN = 0, SOPHMORE = 1, JUNIOR = 2, SENIOR = 3};
@SurajDas-zi7wb2 жыл бұрын
thanks you so much for the lecture 💜 eagerly waiting for oop leacture :)
@Dazza_Doo2 жыл бұрын
Although the point of this exercise is to use enums, here a swtich epressions is why I love them. Enums can be difficult to iterate though, and maybe getting the sizeof(Enum) might work in C++, in C# it gets a little advanced.
@Henry-sv3wv13 күн бұрын
yea, but C# is that microsoft language and i use Linux
@akielstewart-r3b3 ай бұрын
Gonna use this to try making a snake game. This explanation was great.
@Lil--E3 ай бұрын
Very helpful and clear. Thank you.
@NotMarkKnopflerАй бұрын
Enums make more sense when used with the scope resolution operator. So instead of int day = saturday; I would use int day = Day::saturday; Without it you may as well use variables or #defines.
@Henry-sv3wv12 күн бұрын
use enum class if you don't want trouble
@paulinek106Ай бұрын
could you explain the differences between arrays and enums. Im beginner and for me it is kinda similar
@offlakom2251Ай бұрын
Array => Day[2] Enum=> Day::mon
@charan_0086Ай бұрын
enums are similar to arrays but we can modify indices
@@baconheadhair6938 I only love my bed and my mama im sorry
@nawaftahir7060Ай бұрын
i got the concepts now ;)
@SawyerCarlson-h6f2 ай бұрын
enum Family { yourself = 18, dad = 58, mom = 60, brother = 21, sister = 19 }
@MarwanNasser-c5b5 ай бұрын
enum person{ahmed=0,hossam=1,anas=2,khaled=3};
@KrittapasPuangmaha6 ай бұрын
Thank you
@hortusdeescapismo3 ай бұрын
how does this 4 month vid have comment from 2 years ago
@PCgamers694203 ай бұрын
enum Month {January, February, March, April, May, June, July, August, September, October, November, December};
@Henry-sv3wv12 күн бұрын
January=1, February, March, ... to make the numbering start with 1 and not 0
@notmidhun23653 ай бұрын
so do enum and struct does the same things basically?
@serfyboi234522 ай бұрын
kinda but not really it works alot like an array if that makes sense
@Abhishek-m3o9v9 ай бұрын
have one doubt, how to use enums in arithmetic operations?
@mvisperas4 ай бұрын
Enums are used as selector. The advantage of enums is the code is more readable. Instead of: if (Day == 0) // user doesn't need to figure out what 0 means. Better: If (Day == sunday)
@Henry-sv3wv12 күн бұрын
enum sucks, use class enum
@snajper41416 ай бұрын
And what about enums in classes?
@Henry-sv3wv12 күн бұрын
enum sucks, use enum class
@ThisL1ght Жыл бұрын
enum Variables{integer, boolean}; Other variables didn't work
@mhmwoodar26784 ай бұрын
enum afterVideo {Like, coummt, like and coummt}
@chinno064 ай бұрын
I love pizza day haha
@iteaahorma2 ай бұрын
😂😂❤❤❤❤❤❤❤
@danaildoganov10 ай бұрын
#include enum player {Messi, Ronaldo, Neymar, Ronaldinho, Suarez, Stoichkov}; int main() { player best = Ronaldinho; switch(best){ case Messi: std::cout