Question #99311

"Display recored of opinent cricket team with season wise like season type, season name, season year and win or loss and compare result of the team"
Using double linked list

Expert's answer

#include <iostream>

#include <list>




using namespace std;


struct Team

{

  string season_name;

  char season_type;

  char WorL;

  int season_year;

};



void display(list<Team> myList);



int main()

{

  list<Team> myList;

  Team first, second;

  cout << "Enter season name of first team: ";

  cin >> first.season_name;

  cout << "Enter season type of first team: ";

  cin >> first.season_type;

  cout << "Enter W or L of first team: ";

  cin >> first.WorL;

  cout << "Enter season year of first team: ";

  cin >> first.season_year;

  myList.push_back(first);

  cout << "Enter season name of second team: ";

  cin >> second.season_name;

  cout << "Enter season type of second team: ";

  cin >> second.season_type;

  cout << "Enter W or L of second team: ";

  cin >> second.WorL;

  cout << "Enter season year of second team: ";

  cin >> second.season_year;

  myList.push_back(second);

  display(myList);

  return 0;

}



void display(list<Team> myList)

{

  for (list<Team>::iterator it = myList.begin(); it != myList.end(); ++it)

  cout << "Season name:  " << it->season_name << endl << "Season type:  " << it->season_type << endl << "Win or Lose:  " << it->WorL << endl << "Season year:  " << it->season_year << endl;

}



LATEST TUTORIALS
APPROVED BY CLIENTS