提供高质量的essay代写,Paper代写,留学作业代写-天才代写

首頁 > > 詳細

代寫Program語言編程、data程序代寫、代做C/C++編程代做SPSS|代寫Web開發

Due Sunday by 11:59pm Points 90 Submitting a file upload File Types tar
Available until Apr 16 at 11:59pm
Start Assignment
The Magician Spellbook Catalog
Problem Statement
The great magic university of Fakebills has been adding a lot of new spellbooks to their library lately.
The school administration has hired you to create a spellbook catalog program that will make
searching for spellbooks easier.
To simplify your task, the school has provided you with their spellbook information. These come in the
form of a text file that file contains a list of Fakebill's spellbooks and their included spells, all of the
information that your program will display.
Requirements
Command Line Argument:
When starting the program, the user will provide one command line argument. The command line
argument will be the name of the file that contains the information about spellbooks and included
spells. If the user does not provide the name of an existing file the program should print out an error
message and quit.
Sorting and Printing:
Once the program begins, the user should be prompted with a list of different ways to display the
spellbook and spell information. After the user has chosen an option, they should be asked if they
want the information printed to the screen or written to a file. If they choose to write to a file, they
should be prompted for a file name. If the file name already exists, the information should be
appended to the file. If the file name does not exist, a file should be created and the information
should be written to the file.
Available Options:
Sort spellbooks by number of pages: If the user picks this option the books must be sorted in
ascending order by number of pages. Once they are sorted, you should print/write to file the title
of the book and the number of pages it has.
Sort spells by effect: There are five types of spells: fire, bubble, memory_loss, death, poison. The
spells with bubble as the effect should be listed first, followed by memory_loss, fire, poison, and
death. Once they are sorted, you should print/write to file the spell name and its effect.
?
2021/4/7 Program 1
https://canvas.oregonstate.edu/courses/1810763/assignments/8376088 2/8
Sort by average success rate of spells: You must create a list of books sorted by the average
success rate of all the spells contained within the book. Once calculated, you should print/write to
file the title of each applicable book and the corresponding average success rate.
Quit: The program will exit.
Your program should continue sorting and printing/writing until the user chooses to quit. For the
sorting functionality, you can write your own sorting function, or consider using C++'s built in sort
function.
Required Structs:
The following structs are required in your program. They will help organize the information that will be
read in (or derived) from the files. You cannot modify, add, or take away any part of the struct.
The spellbook struct will be used to hold information from the spellbooks.txt file. This struct holds
information about a spellbook.
struct spellbook {
string title;
string author;
int num_pages;
int edition;
int num_spells;
float avg_success_rate;
struct spell* s;
};
The spell struct will also be used to read in information from the spellbooks.txt file. This struct holds
information about a spell. There are five options for effect: "fire", "poison", "bubble", "death", or
"memory_loss".
struct spell {
string name;
float success_rate;
string effect;
};
Required Functions:
You must implement the following functions in your program. You are not allowed to modify these
required function declarations in any way. Note: it is acceptable if you choose to add additional
functions (but you must still include the required functions). Note2: You must write the dynamic
memory allocation functionality yourself (i.e. no using vectors).
This function will dynamically allocate an array of spellbooks (of the requested size):
spellbook* create_spellbooks(int);
?
2021/4/7 Program 1
https://canvas.oregonstate.edu/courses/1810763/assignments/8376088 3/8
This function will fill a spellbook struct with information that is read in from spellbooks.txt. Hint:
“ifstream &” is a reference to a filestream object. You will need to create one and pass it into this
function to read from the spellbooks.txt file.
void get_spellbook_data(spellbook*, int, ifstream &);
This function will dynamically allocate an array of spells (of the requested size):
spell* create_spells(int);
This function will fill a spell struct with information that is read in from spellbooks.txt.
void get_spell_data(spell*, int, ifstream &);
You need to implement a function that will delete all the memory that was dynamically allocated. You
can choose the prototype. A possible example prototype includes the following:
void delete_spellbook_data(spellbook*, int);
Required Input File Format
Your program must accommodate the file formats as specified in this section. The spellbooks.txt file
has the following structure. The file information will be provided in sets (corresponding to each
spellbook). Each spellbook will be accompanied by a listing of the spells inside.
The spellbooks.txt file will have the following pattern, and an example can be found here
(https://canvas.oregonstate.edu/courses/1810763/files/85698756/download?download_frd=1) :

聯系我們
  • QQ:1067665373
  • 郵箱:1067665373@qq.com
  • 工作時間:8:00-23:00
  • 微信:Badgeniuscs
熱點文章
程序代寫更多圖片

聯系我們 - QQ: 1067665373 微信:Badgeniuscs
? 2021 uk-essays.net
程序代寫網!

在線客服

售前咨詢
售后咨詢
微信號
Essay_Cheery
微信
全优代写 - 北美Essay代写,Report代写,留学生论文代写作业代写 北美顶级代写|加拿大美国论文作业代写服务-最靠谱价格低-CoursePass 论文代写等留学生作业代做服务,北美网课代修领导者AssignmentBack 北美最专业的线上写作专家:网课代修,网课代做,CS代写,程序代写 代码代写,CS编程代写,java代写北美最好的一站式学术代写服务机构 美国essay代写,作业代写,✔美国网课代上-最靠谱最低价 美国代写服务,作业代写,CS编程代写,java代写,python代写,c++/c代写 代写essay,作业代写,金融代写,business代写-留学生代写平台 北美代写,美国作业代写,网课代修,Assignment代写-100%原创 北美作业代写,【essay代写】,作业【assignment代写】,网课代上代考