/* Programmer: Joshua Zuber
Program Desc: This is a game that can keep track of players scores!
Program Name: Score Tracker
Clean Compile Date:
*/
#include<iostream>
#include<string>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include <vector>
using namespace std;
int main()
{
// Player Variables
string player1
string player2;
string player3;
string player4;
string player5;
// Variables
char again = 'y';
char menu1 = 'y';
int pNumb;
// Game Arrays
string player1G[] = "";
string player2G[] = "";
string player3G[] = "";
string player4G[] = "";
string player5G[] = "";
// Score Arrays
string player1S[] = "";
string player2S[] = "";
string player3S[] = "";
string player4S[] = "";
string player5S[] = "";
while (toupper(again) == 'Y')
{
cout << "Welcome to Score Tracker!" << "\n\n";
while (toupper(menu1) == 'Y')
{
cout << "1. " << player1 << "\n\n";
cout << "2. " << player2 << "\n\n";
cout << "3. " << player3 << "\n\n";
cout << "4. " << player4 << "\n\n";
cout << "5. " << player5 << "\n\n";
cout << "Please select a player to add your favorite games and scores!";
cin >> pNumb;
system("cls");
if (pNumb == 1)
{
cout << "Please enter a name for player 1!" << "\n\n";
cin >> player1;
cin.getline(player1);
cout << "\n\n" << "Would you like to return to menu? Y/N " << "\n\n";
cin >> menu1 ;
system("cls");
}
}
}
}
How do I take a users input that has spaces and return it to a string? I am trying to make a simple program that takes 5 users names and has them input their 3 favorite games but i am having trouble with just getting them to input their names for the menu.