You're welcome Elie! :-) And great question too. #define is a preprocessor directive, where the preprocessor is an early stage of the compilation of a C/C++ program. When we use define to define a preprocessor constant, i.e. a macro, the compiler's preprocessor phase will replace all occurrences of a preprocessor constant like 'SCISSORS' with '3'. So it's a helpful way of defining constant values to be used throughout our program. It can improve the readability of the program, by using something like 'SCISSORS' instead of '3' directly. And if the constant value needs to change, we can change it one place. enum is a user-defined type, and the values of the type are a group of constants that we can define. And by 'user-defined' we mean 'programmer-defined', not the user of the software. It plays a similar role in that we can define an enum with values like for example ROCK, PAPER, SCISSORS, and then use those values throughout the program even though the 'real' underling value will be an integer. This will improve code readability. With enum we can declare values using the type, with preprocessor constants we aren't really defining a 'type'. It would make sense to use enum if we want to declare variables, structs and/or arrays that will store and use values of this type (really integers though). I have some videos on these topics. :-) enum Tutorial: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-oQFN_oi7k3E.html constants Tutorial: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-r0OuA1Q8jOo.html
Visual Studio or Visual Studio Code should be good on Windows. :-) This video might help: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-gq_ZXCuRhU4.html.
how can I learn C programming in 6 months? I have failed the programming exam in my first semester this year. I should focus only on solving problems? If yes, can you recommend me some websites where I can solve problems?
That's a great question Raul. I'm sorry to hear that about the programming exam, but I can try to offer some advice. So in terms of the resources on this channel that may be able to help you, there is this C Programming for Beginners course: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-ssJY5MDLjlo.html. Then there is this playlist of C Programming Tutorial covering lots of concepts in more depth: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-gq_ZXCuRhU4.html. And there is also this playlist of C Programming Examples covering solutions to many programming problems: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-sepK5w4Uep0.html. In terms of "what to focus on", the truth is you very likely want to go back and forth between trying to problems, and consuming materials like RU-vid videos, textbooks and online resources. Because it's difficult to solve problems without knowing the background concepts, but at the same time test questions will likely involve application of concepts so the problem solving is important too. Getting better at programming takes a lot of people a long time, because it's a new type of problem solving. But it's not like solving problems in say for example, a high school physics course, where we re-arrange and equation and put in numbers to perform a calculation. Programming often involves solving problems that are very "new" and "novel", or at least, they feel that way. New programmers will often say "I knew all the concepts, but I didn't know where to start or how to put them all together". That's where going over many, many problem solutions can help you. Because what happens is as you go over solutions to problems, your brain builds a "toolbox" or "library" of old solutions that it can reference later. :-) So if you go over many problems involving file access, you begin to notice patterns like opening the file, reading data, closing the file. And then when you see similar problems, over time it becomes easier to recognize that things you have seen in old solutions can be re-applied, perhaps with some tweaking. Almost nobody can just write amazing programs to solve new problems from scratch, most of us have to spend a long time going over other solutions before we can begin to more easily see patterns and apply prior knowledge to new problems. So I would actually recommend going over many, many solutions to problems. And once you have gone over many in an "area" of C, like arrays, or strings, or file access, then trying to solve new problems in that same "area". You might be surprised that it feels easier than before somehow. I have started this playlist to help new programmers in particular: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-RDvlJaeGqyU.html. There's lots of great websites for C practice, I like this one but I suspect there are "cooler" ones out there like CS50 or CodingBat, etc: www.w3resource.com/c-programming-exercises/. :-)
I strongly suspect it's possible. :-) It may come at the "cost" of making the code a bit harder to read. But maybe we could put the win-los-draw states into a 2D array, and use the 2D array to decide the winner, so we could check game[player_throw][ai_throw] (or something like that). That's the only way I can think to do it off the top of my head, maybe someone else can chime in with another/better idea! :-)
I didn't notice that, but yes. :-) The code/game is OK though, the AI will throw other things, that's just how it came out when I tested it in the video.