C++ ROCK PAPER SCISSORS game for beginners 👊

  Рет қаралды 16,422

Bro Code

Bro Code

Күн бұрын

#rock #paper #scissors
C++ rock paper scissors game tutorial example project explained

Пікірлер: 49
@BroCodez
@BroCodez 2 жыл бұрын
#include #include char getUserChoice(); char getComputerChoice(); void showChoice(char choice); void chooseWinner(char player, char computer); int main() { char player; char computer; player = getUserChoice(); std::cout
@ahmadosama2652
@ahmadosama2652 2 жыл бұрын
In chooseWinner function if we use if statement it will be more easier if(user == computer) std::cout
@realanderect6467
@realanderect6467 Жыл бұрын
did the same🤝
@ahmedghaly7161
@ahmedghaly7161 7 ай бұрын
@@realanderect6467 can i ask where are you now at the programming guys ?
@alwinsanthosh6878
@alwinsanthosh6878 7 ай бұрын
I'm only a beginner, but i feel like a dumbass for not recognizing this simpler form of code.
@realanderect6467
@realanderect6467 6 ай бұрын
@@ahmedghaly7161 I am currently doing DSA in java... i liked java more than c++
@FrederikWollert
@FrederikWollert 10 ай бұрын
I really like your C++ series. Keep it up. Please make more C++ Videos. So, let's defeat the KZbin algorithm.
@Zyxmil
@Zyxmil Жыл бұрын
I don't know if anyone will see this, but I've tried making this program before seeing this video, what do you guys think on it #include #include char random(char comp); void final(char comp); int main() { std::cout answer; char finalanswer = toupper(answer); if (finalanswer == 'R' && comp == 'r') { std::cout
@OdonChess
@OdonChess 4 ай бұрын
seems cool but im just stating to learn c++ yesterday i dont understand a thing
@djprgotube
@djprgotube 2 ай бұрын
Before watching this I also made an rps game, and although I used fewer lines of code, the if statements were messy for me. Great educational vid!
@zabiullahsafdari-to8zw
@zabiullahsafdari-to8zw Жыл бұрын
Great
@ChekoleMajlan
@ChekoleMajlan 4 ай бұрын
the way u did it was amazing thanks a lot
@criminalx7099
@criminalx7099 2 жыл бұрын
well explained bro
@sliky7317
@sliky7317 2 жыл бұрын
I made this game before you made this video... but mine was so janky, It works though. I keep having issues with some things like while loops, and I think it's because I'm using an online compiler because I don't know any downloads for chromebook. Thanks for the free coding lessons man. Have a great day!
@leomabuku1904
@leomabuku1904 10 ай бұрын
This was weirdly silly but impressive Way of thinking implementation
@Zzzoott
@Zzzoott 8 ай бұрын
My solution, #include #include int start() { std::cout > x; return x; } std::string raand() { srand(time(NULL)); int a; a = 1 + rand() % 3; std::string str1; if (a == 1) { str1 = "ROCK"; } if (a == 2) { str1 = "PAPER"; } if (a == 3) { str1 = "SCISSOR"; } return str1; } int foo(int a) { int score(0); for (int i = 1; i
@yellowhellow-wi9gi
@yellowhellow-wi9gi 4 ай бұрын
thank a lot
@NoBeerNoLife1789
@NoBeerNoLife1789 Жыл бұрын
very thanks dude
@TheBoringGuy-h2z
@TheBoringGuy-h2z Жыл бұрын
pls rate my code: #include #include using namespace std; int main() { bool run = true; while(run) { //all the variables std::string player; std::string computer; srand(time(NULL)); int random = rand() % 3 + 1; std::string win; //variable for wanting to continue std::string want_continue; //main std::cout player; //code for the computer if(random == 1) { computer = "rock"; std::cout
@memezilla2964
@memezilla2964 8 ай бұрын
10/10
@ЦветелинМаринов-е3з
@ЦветелинМаринов-е3з 11 ай бұрын
The name of the theme u use ?
@Sahan-od3vq
@Sahan-od3vq 7 ай бұрын
bro why do you prefer defining functions rather than typing in whole like you did in python? is there any reason ?? does defining functions reduces the compiling time??
@FaiyazHasan-o1c
@FaiyazHasan-o1c 3 ай бұрын
It's okay if you write other functions before you use it in the main function. If you write it after main function without defining it first, it most likely won't work cuz the interpreter/compiler is simply not aware of the function you are calling.
@Sahan-od3vq
@Sahan-od3vq 3 ай бұрын
yeah what u said is right.but, I mean why did he define functions for each operation rather than writting the same code in main function without defining any function?
@FaiyazHasan-o1c
@FaiyazHasan-o1c 3 ай бұрын
@@Sahan-od3vq It's easier that way. Writing everything in the main function can make it a bit complicated. However you are free to do it if it works.
@Sahan-od3vq
@Sahan-od3vq 3 ай бұрын
@@FaiyazHasan-o1c yes a valid reason.Thank you.
@FaiyazHasan-o1c
@FaiyazHasan-o1c 3 ай бұрын
@@Sahan-od3vq You are most welcome
@Kaemi0273
@Kaemi0273 Ай бұрын
Guys, I have a problem. So, it doesnt show for me my choice and doesnt show me who won. It shows what the computer picked, but not what i did. Anyone knows whats up?
@u___f
@u___f Жыл бұрын
Hi everyone, I added a do while loop in the main function to enable repeating the game and tried to display a counter each for the wins, ties and losses But the counters only worked when I copied the code from the chooseWinner function into the main function Does anyone have an idea how it would work with using the function? Thanks in any case
@u___f
@u___f Жыл бұрын
*it worked after using „int&“ in the function definition and declaration but not with „int“ only
@realanderect6467
@realanderect6467 Жыл бұрын
@@u___f yeah it is so because & means reference to a variable (address of a variable)... so if u just use int the value of the variable will go into the function and any change in u do in the function will not change the value of the variable... but if you use reference variable (&int), the address of the variable will go into the function and any change in u make in the function will change the value at that specific address.. thereby changing the value of the variable in the main function.
@lue224
@lue224 2 жыл бұрын
why are you making so many functions you only need them once?
@ChrisVideosGreek
@ChrisVideosGreek 2 жыл бұрын
to make it beginner-friendly
@lue224
@lue224 2 жыл бұрын
@@ChrisVideosGreek yes but without it's simpler imo
@oximas-oe9vf
@oximas-oe9vf 2 жыл бұрын
@@lue224 it makes the program look cleaner and more understandable
@mrrobot-e4b
@mrrobot-e4b Жыл бұрын
to organise the code in a more readable way
@hupmitom5509
@hupmitom5509 Жыл бұрын
the game is so funny, thank you.
@albatablays24
@albatablays24 Жыл бұрын
you wrote void showChoice(char choice) where is the choice. You haven't declared a choice data in any of the function
@realanderect6467
@realanderect6467 Жыл бұрын
choice is a function variable which is declared in the function parameter list... when we called the function in the main function ( showChoice(player); ) that actually means that the value of choice in the function will be equal to player's value;
@ayaanshaikh2018
@ayaanshaikh2018 7 ай бұрын
but why is the computer losing against me at every try?? can we fix that ??
@Devilhunter69
@Devilhunter69 Ай бұрын
Lmao fix what, i think its a skill issue from your computer's side
@EliaPerzian-xy3co
@EliaPerzian-xy3co Жыл бұрын
Can someone please explain to me the void showchoice(char choice) why did we enter char choice and didnt use choice
@willixm2520
@willixm2520 Жыл бұрын
when declaring the function, because we're passing in a variable through it, we have to also declare the datatype of the variable, which in this case is a char. Just like when creating a variable, we want to specify its datatype. Hope that helps and correct me if I'm wrong.
@thecrazytv6766
@thecrazytv6766 9 ай бұрын
I did it a little bit different but it still works, don't mind the language it's serbian... #include #include char UnosKorisnika; void papir(char UnosKorisnika); void kamen(char UnosKorisnika); void makaze(char UnosKorisnika); int main() { srand(time(NULL)); std::cout
C++ arrays explained 🚗
5:29
Bro Code
Рет қаралды 45 М.
C++ TIC TAC TOE game for beginners ⭕
19:09
Bro Code
Рет қаралды 46 М.
БОЙКАЛАР| bayGUYS | 27 шығарылым
28:49
bayGUYS
Рет қаралды 1,1 МЛН
Wednesday VS Enid: Who is The Best Mommy? #shorts
0:14
Troom Oki Toki
Рет қаралды 50 МЛН
C++ Banking program for beginners 💰
13:53
Bro Code
Рет қаралды 18 М.
Rock Paper Scissors Game in C++
10:48
Kenny Yip Coding
Рет қаралды 3,6 М.
The Rust Survival Guide
12:34
Let's Get Rusty
Рет қаралды 181 М.
C++ QUIZ GAME for beginners 💯
11:46
Bro Code
Рет қаралды 11 М.
Build JavaScript ROCK PAPER SCISSORS in 18 minutes! 👊
18:54
Learning C++ by making a Game... in 1 Week?!
10:14
Floky
Рет қаралды 682 М.
C++ CLASSES & OBJECTS explained easy 🧍
10:54
Bro Code
Рет қаралды 50 М.
How I program C
2:11:32
Eskil Steenberg
Рет қаралды 806 М.
Rock Paper Scissors Game | C++ Example
12:33
Portfolio Courses
Рет қаралды 13 М.
БОЙКАЛАР| bayGUYS | 27 шығарылым
28:49
bayGUYS
Рет қаралды 1,1 МЛН