Answer to Question #99311 in C++ for Fahad

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
1
Expert's answer
2019-11-25T07:28:00-0500

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

}



Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS