Rock, Paper & ScissorsRock-Paper-Scissors gameSimplification and efficiency suggestions for “Rock,...
Why does String.replaceAll() work differently in Java 8 from Java 9?
Cryptic with missing capitals
A universal method for left-hand alignment of a sequence of equalities
Would a National Army of mercenaries be a feasible idea?
Disable the ">" operator in Rstudio linux terminal
How do I say "Brexit" in Latin?
How should I handle players who ignore the session zero agreement?
Why don't American passenger airlines operate dedicated cargo flights any more?
Program that converts a number to a letter of the alphabet
Can I become debt free or should I file for bankruptcy? How do I manage my debt and finances?
Can I write a book of my D&D game?
Slow moving projectiles from a hand-held weapon - how do they reach the target?
It took me a lot of time to make this, pls like. (YouTube Comments #1)
How to deal with an incendiary email that was recalled
How would a Dictatorship make a country more successful?
Check if the digits in the number are in increasing sequence in python
Jumping Numbers
What's the most convenient time of year to end the world?
Word or phrase for showing great skill at something without formal training in it
Notes in a lick that don't fit in the scale associated with the chord
What flying insects could re-enter the Earth's atmosphere from space without burning up?
What does Cypher mean when he says Neo is "gonna pop"?
What makes the Forgotten Realms "forgotten"?
How do you funnel food off a cutting board?
Rock, Paper & Scissors
Rock-Paper-Scissors gameSimplification and efficiency suggestions for “Rock, Paper, Scissors” gameRock, paper, scissorsRock, Paper, Scissors gameCheese-Burger-Waffles (aka Rock-Paper-Scissors)Rocks, Paper Scissors gameRock-paper-scissors console implementationSimple rock-paper-scissors game [Follow Up 1]Red implementation of Rock, Scissors, PaperRock, Paper, Scissors. C++
$begingroup$
Thanks for your time, I am new to programming and I spent some days making this rock, paper & scissor game. What other possible improvements could I make after the ones I've made myself?
I've tried explaining each step as the program goes on, but I essentially at first generate a computer pick (i.e. Rock, Paper or Scissor), then ask the user for their pick (i.e. rock
, paper
or scissor
), compare the two and depending on the game rules (Rock vs Paper results in a loss for the Rock), output the game result.
Again, this is my first try at it. Some improvements I've already added myself are: getline
instead of cin
, use of functions and switches, shortened the code and merged outputs in little space.
Thank you for helping a new-entry at coding.
main.cpp
#include "main.h"
int main(int argc, const char * argv[]) {
//variables.
string usrPick;
string stringResult;
char randPick = fnc.randPick(); //generates the first random pick.
int gameCountr = 0;
//beginning of the program.
cout << endl << "GAME " << gameCountr << " ~ ";
while (getline(cin, usrPick) && ++gameCountr) {
//variables.
char gameResult = fnc.gameResults(fnc.toChar(usrPick), randPick);
//converts game result to readable text.
switch (gameResult) {
case 'e': stringResult = "even";
break;
case 'w': stringResult = "won";
break;
case 'l': stringResult = "lost";
break;
default: stringResult = "?";
break;
}
//prints out the choices and who won the game.
cout << "you: " << fnc.toChar(usrPick) << " / computer: " << randPick << " / " << stringResult << endl << endl << endl;
//generates a new random choice.
randPick = fnc.randPick();
//prompts the user to input their choice to play again.
cout << "GAME " << gameCountr << " ~ ";
}
return 0;
}
main.h
#ifndef main_h
#define main_h
#include <iostream>
#include <vector>
using namespace std;
class exercise2 {
public:
char toChar(string word);
char randPick();
char gameResults(char usr_ch, char cmptr_ch);
private:
char outp_s;
};
exercise2 fnc;
//converts to char the user input.
char exercise2::toChar(string inpt_s) {
//reinitializes value.
outp_s = NULL;
if (inpt_s == "rock") {
outp_s = 'R';
} else if (inpt_s == "paper") {
outp_s = 'P';
} else if (inpt_s == "scissor") {
outp_s = 'S';
} else {
outp_s = '?';
}
return outp_s;
}
//generates a random choice for the computer to play.
char exercise2::randPick() {
//variables.
vector<char> vctrOptions = {'R','P','S'};
//chooses a random value in the given pool of values.
return vctrOptions[rand() % vctrOptions.size()];
}
//prints out the game results.
char exercise2::gameResults(char usr_ch, char cmptr_ch) {
//variables.
outp_s = NULL;
//checks user input and applies game rules.
switch (usr_ch) {
case 'R':
switch (cmptr_ch) {
case 'R': outp_s = 'e';
break;
case 'P': outp_s = 'l';
break;
case 'S': outp_s = 'w';
break;
}
break;
case 'P':
switch (cmptr_ch) {
case 'R': outp_s = 'w';
break;
case 'P': outp_s = 'e';
break;
case 'S': outp_s = 'l';
break;
}
break;
case 'S':
switch (cmptr_ch) {
case 'R': outp_s = 'l';
break;
case 'P': outp_s = 'w';
break;
case 'S': outp_s = 'e';
break;
}
break;
default:
outp_s = '0';
break;
}
return outp_s;
}
#endif
c++ beginner game rock-paper-scissors
New contributor
$endgroup$
add a comment |
$begingroup$
Thanks for your time, I am new to programming and I spent some days making this rock, paper & scissor game. What other possible improvements could I make after the ones I've made myself?
I've tried explaining each step as the program goes on, but I essentially at first generate a computer pick (i.e. Rock, Paper or Scissor), then ask the user for their pick (i.e. rock
, paper
or scissor
), compare the two and depending on the game rules (Rock vs Paper results in a loss for the Rock), output the game result.
Again, this is my first try at it. Some improvements I've already added myself are: getline
instead of cin
, use of functions and switches, shortened the code and merged outputs in little space.
Thank you for helping a new-entry at coding.
main.cpp
#include "main.h"
int main(int argc, const char * argv[]) {
//variables.
string usrPick;
string stringResult;
char randPick = fnc.randPick(); //generates the first random pick.
int gameCountr = 0;
//beginning of the program.
cout << endl << "GAME " << gameCountr << " ~ ";
while (getline(cin, usrPick) && ++gameCountr) {
//variables.
char gameResult = fnc.gameResults(fnc.toChar(usrPick), randPick);
//converts game result to readable text.
switch (gameResult) {
case 'e': stringResult = "even";
break;
case 'w': stringResult = "won";
break;
case 'l': stringResult = "lost";
break;
default: stringResult = "?";
break;
}
//prints out the choices and who won the game.
cout << "you: " << fnc.toChar(usrPick) << " / computer: " << randPick << " / " << stringResult << endl << endl << endl;
//generates a new random choice.
randPick = fnc.randPick();
//prompts the user to input their choice to play again.
cout << "GAME " << gameCountr << " ~ ";
}
return 0;
}
main.h
#ifndef main_h
#define main_h
#include <iostream>
#include <vector>
using namespace std;
class exercise2 {
public:
char toChar(string word);
char randPick();
char gameResults(char usr_ch, char cmptr_ch);
private:
char outp_s;
};
exercise2 fnc;
//converts to char the user input.
char exercise2::toChar(string inpt_s) {
//reinitializes value.
outp_s = NULL;
if (inpt_s == "rock") {
outp_s = 'R';
} else if (inpt_s == "paper") {
outp_s = 'P';
} else if (inpt_s == "scissor") {
outp_s = 'S';
} else {
outp_s = '?';
}
return outp_s;
}
//generates a random choice for the computer to play.
char exercise2::randPick() {
//variables.
vector<char> vctrOptions = {'R','P','S'};
//chooses a random value in the given pool of values.
return vctrOptions[rand() % vctrOptions.size()];
}
//prints out the game results.
char exercise2::gameResults(char usr_ch, char cmptr_ch) {
//variables.
outp_s = NULL;
//checks user input and applies game rules.
switch (usr_ch) {
case 'R':
switch (cmptr_ch) {
case 'R': outp_s = 'e';
break;
case 'P': outp_s = 'l';
break;
case 'S': outp_s = 'w';
break;
}
break;
case 'P':
switch (cmptr_ch) {
case 'R': outp_s = 'w';
break;
case 'P': outp_s = 'e';
break;
case 'S': outp_s = 'l';
break;
}
break;
case 'S':
switch (cmptr_ch) {
case 'R': outp_s = 'l';
break;
case 'P': outp_s = 'w';
break;
case 'S': outp_s = 'e';
break;
}
break;
default:
outp_s = '0';
break;
}
return outp_s;
}
#endif
c++ beginner game rock-paper-scissors
New contributor
$endgroup$
$begingroup$
Welcome to Code Review! I changed the title so that it describes what the code does per site goals: "State what your code does in your title, not your main concerns about it.". Feel free to edit and give it a different title if there is something more appropriate.
$endgroup$
– Sᴀᴍ Onᴇᴌᴀ
9 hours ago
$begingroup$
note to reviewers- this was originally posted on SO - while it may be closed as off-topic there soon, it currently has one answer
$endgroup$
– Sᴀᴍ Onᴇᴌᴀ
9 hours ago
2
$begingroup$
Seems you come from Java regarding your Java-ish programming style. Not everything has to be in a class in C++.
$endgroup$
– L. F.
7 hours ago
add a comment |
$begingroup$
Thanks for your time, I am new to programming and I spent some days making this rock, paper & scissor game. What other possible improvements could I make after the ones I've made myself?
I've tried explaining each step as the program goes on, but I essentially at first generate a computer pick (i.e. Rock, Paper or Scissor), then ask the user for their pick (i.e. rock
, paper
or scissor
), compare the two and depending on the game rules (Rock vs Paper results in a loss for the Rock), output the game result.
Again, this is my first try at it. Some improvements I've already added myself are: getline
instead of cin
, use of functions and switches, shortened the code and merged outputs in little space.
Thank you for helping a new-entry at coding.
main.cpp
#include "main.h"
int main(int argc, const char * argv[]) {
//variables.
string usrPick;
string stringResult;
char randPick = fnc.randPick(); //generates the first random pick.
int gameCountr = 0;
//beginning of the program.
cout << endl << "GAME " << gameCountr << " ~ ";
while (getline(cin, usrPick) && ++gameCountr) {
//variables.
char gameResult = fnc.gameResults(fnc.toChar(usrPick), randPick);
//converts game result to readable text.
switch (gameResult) {
case 'e': stringResult = "even";
break;
case 'w': stringResult = "won";
break;
case 'l': stringResult = "lost";
break;
default: stringResult = "?";
break;
}
//prints out the choices and who won the game.
cout << "you: " << fnc.toChar(usrPick) << " / computer: " << randPick << " / " << stringResult << endl << endl << endl;
//generates a new random choice.
randPick = fnc.randPick();
//prompts the user to input their choice to play again.
cout << "GAME " << gameCountr << " ~ ";
}
return 0;
}
main.h
#ifndef main_h
#define main_h
#include <iostream>
#include <vector>
using namespace std;
class exercise2 {
public:
char toChar(string word);
char randPick();
char gameResults(char usr_ch, char cmptr_ch);
private:
char outp_s;
};
exercise2 fnc;
//converts to char the user input.
char exercise2::toChar(string inpt_s) {
//reinitializes value.
outp_s = NULL;
if (inpt_s == "rock") {
outp_s = 'R';
} else if (inpt_s == "paper") {
outp_s = 'P';
} else if (inpt_s == "scissor") {
outp_s = 'S';
} else {
outp_s = '?';
}
return outp_s;
}
//generates a random choice for the computer to play.
char exercise2::randPick() {
//variables.
vector<char> vctrOptions = {'R','P','S'};
//chooses a random value in the given pool of values.
return vctrOptions[rand() % vctrOptions.size()];
}
//prints out the game results.
char exercise2::gameResults(char usr_ch, char cmptr_ch) {
//variables.
outp_s = NULL;
//checks user input and applies game rules.
switch (usr_ch) {
case 'R':
switch (cmptr_ch) {
case 'R': outp_s = 'e';
break;
case 'P': outp_s = 'l';
break;
case 'S': outp_s = 'w';
break;
}
break;
case 'P':
switch (cmptr_ch) {
case 'R': outp_s = 'w';
break;
case 'P': outp_s = 'e';
break;
case 'S': outp_s = 'l';
break;
}
break;
case 'S':
switch (cmptr_ch) {
case 'R': outp_s = 'l';
break;
case 'P': outp_s = 'w';
break;
case 'S': outp_s = 'e';
break;
}
break;
default:
outp_s = '0';
break;
}
return outp_s;
}
#endif
c++ beginner game rock-paper-scissors
New contributor
$endgroup$
Thanks for your time, I am new to programming and I spent some days making this rock, paper & scissor game. What other possible improvements could I make after the ones I've made myself?
I've tried explaining each step as the program goes on, but I essentially at first generate a computer pick (i.e. Rock, Paper or Scissor), then ask the user for their pick (i.e. rock
, paper
or scissor
), compare the two and depending on the game rules (Rock vs Paper results in a loss for the Rock), output the game result.
Again, this is my first try at it. Some improvements I've already added myself are: getline
instead of cin
, use of functions and switches, shortened the code and merged outputs in little space.
Thank you for helping a new-entry at coding.
main.cpp
#include "main.h"
int main(int argc, const char * argv[]) {
//variables.
string usrPick;
string stringResult;
char randPick = fnc.randPick(); //generates the first random pick.
int gameCountr = 0;
//beginning of the program.
cout << endl << "GAME " << gameCountr << " ~ ";
while (getline(cin, usrPick) && ++gameCountr) {
//variables.
char gameResult = fnc.gameResults(fnc.toChar(usrPick), randPick);
//converts game result to readable text.
switch (gameResult) {
case 'e': stringResult = "even";
break;
case 'w': stringResult = "won";
break;
case 'l': stringResult = "lost";
break;
default: stringResult = "?";
break;
}
//prints out the choices and who won the game.
cout << "you: " << fnc.toChar(usrPick) << " / computer: " << randPick << " / " << stringResult << endl << endl << endl;
//generates a new random choice.
randPick = fnc.randPick();
//prompts the user to input their choice to play again.
cout << "GAME " << gameCountr << " ~ ";
}
return 0;
}
main.h
#ifndef main_h
#define main_h
#include <iostream>
#include <vector>
using namespace std;
class exercise2 {
public:
char toChar(string word);
char randPick();
char gameResults(char usr_ch, char cmptr_ch);
private:
char outp_s;
};
exercise2 fnc;
//converts to char the user input.
char exercise2::toChar(string inpt_s) {
//reinitializes value.
outp_s = NULL;
if (inpt_s == "rock") {
outp_s = 'R';
} else if (inpt_s == "paper") {
outp_s = 'P';
} else if (inpt_s == "scissor") {
outp_s = 'S';
} else {
outp_s = '?';
}
return outp_s;
}
//generates a random choice for the computer to play.
char exercise2::randPick() {
//variables.
vector<char> vctrOptions = {'R','P','S'};
//chooses a random value in the given pool of values.
return vctrOptions[rand() % vctrOptions.size()];
}
//prints out the game results.
char exercise2::gameResults(char usr_ch, char cmptr_ch) {
//variables.
outp_s = NULL;
//checks user input and applies game rules.
switch (usr_ch) {
case 'R':
switch (cmptr_ch) {
case 'R': outp_s = 'e';
break;
case 'P': outp_s = 'l';
break;
case 'S': outp_s = 'w';
break;
}
break;
case 'P':
switch (cmptr_ch) {
case 'R': outp_s = 'w';
break;
case 'P': outp_s = 'e';
break;
case 'S': outp_s = 'l';
break;
}
break;
case 'S':
switch (cmptr_ch) {
case 'R': outp_s = 'l';
break;
case 'P': outp_s = 'w';
break;
case 'S': outp_s = 'e';
break;
}
break;
default:
outp_s = '0';
break;
}
return outp_s;
}
#endif
c++ beginner game rock-paper-scissors
c++ beginner game rock-paper-scissors
New contributor
New contributor
edited 8 hours ago
Sᴀᴍ Onᴇᴌᴀ
9,72262165
9,72262165
New contributor
asked 9 hours ago
gravili43gravili43
61
61
New contributor
New contributor
$begingroup$
Welcome to Code Review! I changed the title so that it describes what the code does per site goals: "State what your code does in your title, not your main concerns about it.". Feel free to edit and give it a different title if there is something more appropriate.
$endgroup$
– Sᴀᴍ Onᴇᴌᴀ
9 hours ago
$begingroup$
note to reviewers- this was originally posted on SO - while it may be closed as off-topic there soon, it currently has one answer
$endgroup$
– Sᴀᴍ Onᴇᴌᴀ
9 hours ago
2
$begingroup$
Seems you come from Java regarding your Java-ish programming style. Not everything has to be in a class in C++.
$endgroup$
– L. F.
7 hours ago
add a comment |
$begingroup$
Welcome to Code Review! I changed the title so that it describes what the code does per site goals: "State what your code does in your title, not your main concerns about it.". Feel free to edit and give it a different title if there is something more appropriate.
$endgroup$
– Sᴀᴍ Onᴇᴌᴀ
9 hours ago
$begingroup$
note to reviewers- this was originally posted on SO - while it may be closed as off-topic there soon, it currently has one answer
$endgroup$
– Sᴀᴍ Onᴇᴌᴀ
9 hours ago
2
$begingroup$
Seems you come from Java regarding your Java-ish programming style. Not everything has to be in a class in C++.
$endgroup$
– L. F.
7 hours ago
$begingroup$
Welcome to Code Review! I changed the title so that it describes what the code does per site goals: "State what your code does in your title, not your main concerns about it.". Feel free to edit and give it a different title if there is something more appropriate.
$endgroup$
– Sᴀᴍ Onᴇᴌᴀ
9 hours ago
$begingroup$
Welcome to Code Review! I changed the title so that it describes what the code does per site goals: "State what your code does in your title, not your main concerns about it.". Feel free to edit and give it a different title if there is something more appropriate.
$endgroup$
– Sᴀᴍ Onᴇᴌᴀ
9 hours ago
$begingroup$
note to reviewers- this was originally posted on SO - while it may be closed as off-topic there soon, it currently has one answer
$endgroup$
– Sᴀᴍ Onᴇᴌᴀ
9 hours ago
$begingroup$
note to reviewers- this was originally posted on SO - while it may be closed as off-topic there soon, it currently has one answer
$endgroup$
– Sᴀᴍ Onᴇᴌᴀ
9 hours ago
2
2
$begingroup$
Seems you come from Java regarding your Java-ish programming style. Not everything has to be in a class in C++.
$endgroup$
– L. F.
7 hours ago
$begingroup$
Seems you come from Java regarding your Java-ish programming style. Not everything has to be in a class in C++.
$endgroup$
– L. F.
7 hours ago
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
Here are a couple of random suggestions. See if any of these are helpful.
Make the prompt more explicit to the user, maybe: 'enter rock or paper or scissors or quit: '
It is considered good practice to not use 'using namespace std:=;', instead prefix all the std symbols with std::. So std::cout, std:cin, std::end, etc.. For an initial and small project 'using namespace std;' seems okay.
Have the compiler report warnings. For clang these are some good flags: '-Wall -Wextra -Weverything'
out_s should be declared as a char. so 'char outp_s = NULL;'
$endgroup$
$begingroup$
-Weverything just gives you pages and pages of noise. The other two are OK though.
$endgroup$
– Kerndog73
2 hours ago
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
});
});
}, "mathjax-editing");
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "196"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
gravili43 is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f214577%2frock-paper-scissors%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
Here are a couple of random suggestions. See if any of these are helpful.
Make the prompt more explicit to the user, maybe: 'enter rock or paper or scissors or quit: '
It is considered good practice to not use 'using namespace std:=;', instead prefix all the std symbols with std::. So std::cout, std:cin, std::end, etc.. For an initial and small project 'using namespace std;' seems okay.
Have the compiler report warnings. For clang these are some good flags: '-Wall -Wextra -Weverything'
out_s should be declared as a char. so 'char outp_s = NULL;'
$endgroup$
$begingroup$
-Weverything just gives you pages and pages of noise. The other two are OK though.
$endgroup$
– Kerndog73
2 hours ago
add a comment |
$begingroup$
Here are a couple of random suggestions. See if any of these are helpful.
Make the prompt more explicit to the user, maybe: 'enter rock or paper or scissors or quit: '
It is considered good practice to not use 'using namespace std:=;', instead prefix all the std symbols with std::. So std::cout, std:cin, std::end, etc.. For an initial and small project 'using namespace std;' seems okay.
Have the compiler report warnings. For clang these are some good flags: '-Wall -Wextra -Weverything'
out_s should be declared as a char. so 'char outp_s = NULL;'
$endgroup$
$begingroup$
-Weverything just gives you pages and pages of noise. The other two are OK though.
$endgroup$
– Kerndog73
2 hours ago
add a comment |
$begingroup$
Here are a couple of random suggestions. See if any of these are helpful.
Make the prompt more explicit to the user, maybe: 'enter rock or paper or scissors or quit: '
It is considered good practice to not use 'using namespace std:=;', instead prefix all the std symbols with std::. So std::cout, std:cin, std::end, etc.. For an initial and small project 'using namespace std;' seems okay.
Have the compiler report warnings. For clang these are some good flags: '-Wall -Wextra -Weverything'
out_s should be declared as a char. so 'char outp_s = NULL;'
$endgroup$
Here are a couple of random suggestions. See if any of these are helpful.
Make the prompt more explicit to the user, maybe: 'enter rock or paper or scissors or quit: '
It is considered good practice to not use 'using namespace std:=;', instead prefix all the std symbols with std::. So std::cout, std:cin, std::end, etc.. For an initial and small project 'using namespace std;' seems okay.
Have the compiler report warnings. For clang these are some good flags: '-Wall -Wextra -Weverything'
out_s should be declared as a char. so 'char outp_s = NULL;'
answered 6 hours ago
RunwayBluesRunwayBlues
105
105
$begingroup$
-Weverything just gives you pages and pages of noise. The other two are OK though.
$endgroup$
– Kerndog73
2 hours ago
add a comment |
$begingroup$
-Weverything just gives you pages and pages of noise. The other two are OK though.
$endgroup$
– Kerndog73
2 hours ago
$begingroup$
-Weverything just gives you pages and pages of noise. The other two are OK though.
$endgroup$
– Kerndog73
2 hours ago
$begingroup$
-Weverything just gives you pages and pages of noise. The other two are OK though.
$endgroup$
– Kerndog73
2 hours ago
add a comment |
gravili43 is a new contributor. Be nice, and check out our Code of Conduct.
gravili43 is a new contributor. Be nice, and check out our Code of Conduct.
gravili43 is a new contributor. Be nice, and check out our Code of Conduct.
gravili43 is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Code Review Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f214577%2frock-paper-scissors%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
$begingroup$
Welcome to Code Review! I changed the title so that it describes what the code does per site goals: "State what your code does in your title, not your main concerns about it.". Feel free to edit and give it a different title if there is something more appropriate.
$endgroup$
– Sᴀᴍ Onᴇᴌᴀ
9 hours ago
$begingroup$
note to reviewers- this was originally posted on SO - while it may be closed as off-topic there soon, it currently has one answer
$endgroup$
– Sᴀᴍ Onᴇᴌᴀ
9 hours ago
2
$begingroup$
Seems you come from Java regarding your Java-ish programming style. Not everything has to be in a class in C++.
$endgroup$
– L. F.
7 hours ago