Rock, Paper & ScissorsRock-Paper-Scissors gameSimplification and efficiency suggestions for “Rock,...

What to do when being responsible for data protection in your lab, yet advice is ignored?

Contest math problem about crossing out numbers in the table

How to acknowledge an embarrassing job interview, now that I work directly with the interviewer?

Groups acting on trees

Eww, those bytes are gross

Disable the ">" operator in Rstudio linux terminal

How do I say "Brexit" in Latin?

Word or phrase for showing great skill at something without formal training in it

Can a person refuse a presidential pardon?

Checking for the existence of multiple directories

Does fast page mode apply to ROM?

If I sold a PS4 game I owned the disc for, can I reinstall it digitally?

What is this metal M-shaped device for?

Using only 1s, make 29 with the minimum number of digits

Check if the digits in the number are in increasing sequence in python

Why don't American passenger airlines operate dedicated cargo flights any more?

What is the purpose of easy combat scenarios that don't need resource expenditure?

Would these multi-classing house rules cause unintended problems?

How to prevent users from executing commands through browser URL

Notes in a lick that don't fit in the scale associated with the chord

Why would the Pakistan airspace closure cancel flights not headed to Pakistan itself?

How do you funnel food off a cutting board?

Can a dragon be stuck looking like a human?

Can an insurance company drop you after receiving a bill and refusing to pay?



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++













1












$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









share|improve this question









New contributor




gravili43 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$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
















1












$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









share|improve this question









New contributor




gravili43 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$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














1












1








1





$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









share|improve this question









New contributor




gravili43 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$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






share|improve this question









New contributor




gravili43 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




gravili43 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 9 hours ago









Sᴀᴍ Onᴇᴌᴀ

9,72262165




9,72262165






New contributor




gravili43 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 9 hours ago









gravili43gravili43

61




61




New contributor




gravili43 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





gravili43 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






gravili43 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • $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$
    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










1 Answer
1






active

oldest

votes


















0












$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;'







share|improve this answer









$endgroup$













  • $begingroup$
    -Weverything just gives you pages and pages of noise. The other two are OK though.
    $endgroup$
    – Kerndog73
    2 hours ago













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.










draft saved

draft discarded


















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









0












$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;'







share|improve this answer









$endgroup$













  • $begingroup$
    -Weverything just gives you pages and pages of noise. The other two are OK though.
    $endgroup$
    – Kerndog73
    2 hours ago


















0












$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;'







share|improve this answer









$endgroup$













  • $begingroup$
    -Weverything just gives you pages and pages of noise. The other two are OK though.
    $endgroup$
    – Kerndog73
    2 hours ago
















0












0








0





$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;'







share|improve this answer









$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;'








share|improve this answer












share|improve this answer



share|improve this answer










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




















  • $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












gravili43 is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

is 'sed' thread safeWhat should someone know about using Python scripts in the shell?Nexenta bash script uses...

How do i solve the “ No module named 'mlxtend' ” issue on Jupyter?

Pilgersdorf Inhaltsverzeichnis Geografie | Geschichte | Bevölkerungsentwicklung | Politik | Kultur...