Тёмный

Rock Paper Scissors Game | C++ Example 

Portfolio Courses
Подписаться 234 тыс.
Просмотров 13 тыс.
50% 1

Опубликовано:

 

31 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 25   
@carlojohnl.5515
@carlojohnl.5515 9 месяцев назад
You are better than my teacher, your explanations are on point. Thank you for this Sir!
@ahtalk9847
@ahtalk9847 9 месяцев назад
Great video, i'll be going through your cpp code examples these are very helpful
@conornorris8014
@conornorris8014 12 дней назад
Could you not use switch case or am I noob
@ManOwaRR1
@ManOwaRR1 Год назад
Thx for the video , a question related to c++ , whats the difference between enum and #define ?
@PortfolioCourses
@PortfolioCourses Год назад
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
@jungleboi9009
@jungleboi9009 2 месяца назад
what if i want to keep track of who wins and loses
@DMJ-wx9wq
@DMJ-wx9wq Год назад
What IDE / Software are you using? its really nice and id like to use it as well
@PortfolioCourses
@PortfolioCourses Год назад
I am using Xcode on Mac OS. :-)
@DMJ-wx9wq
@DMJ-wx9wq Год назад
@@PortfolioCourses Yikes, I have a windows Device. Can you Suggest anything similar for windows?
@PortfolioCourses
@PortfolioCourses Год назад
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.
@Raul-0303
@Raul-0303 Год назад
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?
@PortfolioCourses
@PortfolioCourses Год назад
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/. :-)
@hi5wifi-s567
@hi5wifi-s567 Год назад
Can this write abit more concise ?
@PortfolioCourses
@PortfolioCourses Год назад
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! :-)
@GulAsia-u1o
@GulAsia-u1o Год назад
Hello sir ..... I need this program's source code.....
@PortfolioCourses
@PortfolioCourses Год назад
There is a link in the video description. :-)
@GulAsia-u1o
@GulAsia-u1o Год назад
Link is Not open why sir.....?
@jon-markrivero787
@jon-markrivero787 3 месяца назад
your telling me by random chance AI throws scissors 4 times in a row…
@PortfolioCourses
@PortfolioCourses 3 месяца назад
I know eh! The odds of getting 4 of something in a row are about 3.6% I think, so it's unlikely but not astronomically unlikely. :-)
@alidevjiani2639
@alidevjiani2639 Год назад
ai threw scissors 4 times in a row with random?
@PortfolioCourses
@PortfolioCourses Год назад
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.
@alidevjiani2639
@alidevjiani2639 Год назад
@@PortfolioCourses gotcha, its definitely interesting using current time to get a random value. will use in the future
@PortfolioCourses
@PortfolioCourses Год назад
Awesome! :-)
@leonorapacheco3797
@leonorapacheco3797 9 месяцев назад
why ai always throw a scissors...
@PortfolioCourses
@PortfolioCourses 9 месяцев назад
Sounds like something is wrong with random number generation if you are getting that result, this program in the video won’t always throw scissors.
Далее
Lottery Number Generator | C++ Example
8:34
Просмотров 5 тыс.
ROCK PAPER SCISSORS game in Python 🗿
9:29
Просмотров 135 тыс.
Premature Optimization
12:39
Просмотров 827 тыс.
Rock Paper Scissors Game | C Programming Example
10:34
Rock Paper Scissors Game in C++
10:48
Просмотров 2,7 тыс.
Learning C++ by making a Game... in 1 Week?!
10:14
Просмотров 537 тыс.
15 Years Writing C++ - Advice for new programmers
4:04
31 nooby C++ habits you need to ditch
16:18
Просмотров 811 тыс.
C++ ROCK PAPER SCISSORS game for beginners 👊
13:07
Naming Things in Code
7:25
Просмотров 2,2 млн