Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. void user_input(int i, string &secret_message, string &word_display, int &number_players, int &number_rounds);
  7.  
  8. int main(){
  9. string secret_message, word_display;
  10. int number_players, number_rounds;
  11.  
  12. user_input(1,secret_message, word_display, number_players, number_rounds);
  13. cout << secret_message << endl;
  14. cout << word_display << endl;
  15.  
  16. return 0;
  17. }
  18.  
  19. void user_input(int i, string &secret_message, string &word_display, int &number_players, int &number_rounds){
  20. if (i == 0){
  21. cout << "Enter number of players: ";
  22. cin >> number_players;
  23. cout << "Enter the number of rounds: ";
  24. cin >> number_rounds;
  25.  
  26. }
  27. else if (i == 1){
  28. cout << "Enter the secret message: ";
  29. getline(cin,secret_message);
  30.  
  31. cout << "test" << endl;
  32.  
  33. for (int x = 0; x < secret_message.length(); x++){
  34. if (secret_message[x] == ' '){
  35. word_display.append((char*)' ');
  36. }
  37. else {
  38. word_display.append((char*)'_');
  39. }
  40. }
  41. cout << word_display << endl;
  42.  
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement