How to feed info from file handling into a struct

Hi this is the first time that I've posted on this forum and i am a big beginner at C++ so if my information isn't enough let me know. Basically i need a way to feed sports teams and table into a struct. The struct looks like this...
1
2
3
4
5
6
  struct Team {
		string TeamName;
		int Position;
		int Wins;
		int Draws;
		int Loss;


i haven't the slightest idea how to do this for my project that is handed in a couple of days. Help would be greatly appreciated :)
Basically your input function could look like this:
1
2
3
4
5
istream& operator>>(istream& is, Team& team)
{
   // do your reading here
  return is;
}

How does your input file look ?
It depends where the information is coming from – if its from a file then overloading the stream extraction operator >> might be easier: https://www.tutorialspoint.com/cplusplus/input_output_operators_overloading.htm
However, if the data's coming from the keyboard you could have a temporary Team object that receives the data from the user into it's various fields like name, position, win, draw etc and then store the struct objects in a container like std::vector<Team>
Topic archived. No new replies allowed.