Start New Discussion within our Software Development Community

I am working on a struct. The two requirements are for the user to be able to input an entry and then view it. I have two questions, when entering the data shouldn't I be able to enter spaces when entering the address i.e. 654 smith st and store that as address1? and why am i getting a memory addres for my print function?
it displays


#include <string>
#include <iostream>

using namespace std;

struct playerType
    string first;
    string last;
    string address1;
    string address2;
    string city;
    string state;
    string zip;
    int jersey;
}; //end struct

void readIn(playerType player)
    cin >> player.first >> player.last;
    cin    >> player.address1 >> player.address2;
    cin    >> >> player.state;
    cin    >> >> player.jersey;

void printPlayer(playerType player)
    cout << endl << endl << player.first << " " << player.last 
        << endl << player.address1 << endl << player.address2
        << endl << << ", " << player.state
        << " " << << endl << player.jersey << endl;

int main()
    playerType player;

    cout << "Enter all of the player's information in order shown\n"
        "pressing Enter after each entry. First name, last name,\n"
        "address line 1, address line 2, city, state, zip, and jersey number: ";


} //end main

1. To read your data with space use cin.getline( ... )
2. To use the player-data in you functions you need to pass it as reference or as a pointer for example:

void printPlayer(playerType &player) 


void printPlayer(playerType *player) 
This question has already been answered. Start a new discussion instead.