Question: Magic the Gathering Collection : For this assignment, write a C++ program on the Linux system that keeps track of your most valuable Magic Cards.
Magic the Gathering Collection : For this assignment, write a C++ program on the Linux system that keeps track of your most valuable Magic Cards. Instead of saving cards to a file,you will load your card collection into memory, so they can be listed and searched. When the program starts, your program will ask the user to enter the name of an input file, which your program will open and use to load the card collection into memory using an array of structs. The struct definition is listed below struct cardInfo { char name[STR_SIZE]; double price; char set[STR_SIZE]; char type[STR_SIZE]; int count; The input text file will use the same comma separated value format. After the file is loaded, the program will enter a user-controlled loop. Inside of the loop, the program will ask the user what they want to do. In addition to searching and listing, the user will have the option to add another card to the collection, but only in memory; you do not need to add the new card information to the text file for this project. So, the options that the user can (Search for a card by name.List all of the cards.Add a new card to the memory database.Quit)There are 4 functions that you will be required to write for this project in addition to main: loadCards(), addACard(), searchCards(), and listCards(). Call loadCards() when the program starts. Call the other functions in the user-controlled loop. See below for example output and function prototypes.
*****Example Output (User Input in Bold)****** Welcome to the magic card collection program. What is the name of the card file? notAFile.txt notAFile.txt was not found. Try again or type 'quit' to exit the program. What is the name of the card file? cardCollection.txt Successfully loaded 7 cards.
Name Price Set Type Count ------------------------------------------------------------------------------------------------------------------------------------------ All In Good Time 13.22 Archenemy Scheme 1 Enlightened Tutor 14.25 Eternal Masters Instant 3 Helm of Obedience 17.39 Alliances Artifact 4 Liliana the Last Hope 25.55 Eldritch Moon Planeswalker 2 Chaos Orb 7300.00 Beta Artifact 1 Ugin the Spirit Dragon 32.80 Fate Reforged Planeswalker 2 Temporal Trespass 1.77 Fate Reforged Sorcery 4 Zodiac Dragon 239.99 Portal Three Kingdoms Creature 1
What would you like to do? (S)earch for a card, (A)dd a card, (L)ist all cards, or (Q)uit? A What is the name of the card? Living Lands What is the price of the card? 117.00 What set is the card in? Alpha What type is the card? Enchantment How many of this card do you have? One You must enter a positive number. Please try again: -3 You must enter a positive number. Please try again: 1 Successfully added Living Lands to the database.
What would you like to do? (S)earch for a card, (A)dd a card, (L)ist all cards, or (Q)uit? S What is the name of the card? Lady Sun The card Lady Sun was not found in the database.
What would you like to do? (S)earch for a card, (A)dd a card, (L)ist all cards, or (Q)uit? S What is the name of the card? Chaos Orb Information on the card Chaos Orb is as follows: Price: $7300.00, Set: Beta, Type: Artifact, Count: 1
What would you like to do? (S)earch for a card, (A)dd a card, (L)ist all cards, or (Q)uit? L
Name Price Set Type Count ---------------------------------------------------------------------------------------------------------------------- All In Good Time 13.22 Archenemy Scheme 1 Enlightened Tutor 14.25 Eternal Masters Instant 3 Helm of Obedience 17.39 Alliances Artifact 4 Liliana the Last Hope 25.55 Eldritch Moon Planeswalker 2 Chaos Orb 7300.00 Beta Artifact 1 Ugin the Spirit Dragon 32.80 Fate Reforged Planeswalker 2 Temporal Trespass 1.77 Fate Reforged Sorcery 4 Zodiac Dragon 239.99 Portal Three Kingdoms Creature 1 Living Lands 117.00 Alpha Enchantment 1
What would you like to do? (S)earch for a card, (A)dd a card, (L)ist all cards, or (Q)uit? Q Terminating Program.
*****Programming Requirements****** Dont use the string library or any of the STL containers such as vectors. Use the
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
