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; }