Hello everyone for c++ structure basics
I was wondering if there is anyone that can help me out on this. I'm starting to learn structures and I want to know if this is correct . Its pretty basic but for some reason when I run with a test case it wont compile. #include <iostream> #include <string> #include <iomanip> using namespace std; struct Player { Â Â string name; Â Â int number; Â Â string team; Â Â string position; Â Â double battingAverage; }; Player readPlayer() { Â cout << "Enter a player name \n"; Â cin >> name; Â cout << "Enter their number \n"; Â cin >> number; Â getline(256, '\n'); Â cout << "Enter their team name \n"; Â cin >> team; Â cout << "Enter their position \n"; Â cin >> position; Â cout << "Enter their batting average \n"; Â cin >> battingAverage; Â getline(256, '\n'); Â Â Â } void printPlayer(const Player& player) { Â cout << "Player : " << name << endl; Â cout << "Number : " << number << endl; Â cout << "Team : " << team << endl; Â cout << "Position : " << position << endl; Â cout << "battingAverage : " << battingAverage << endl; }