SlideShare ist ein Scribd-Unternehmen logo
1 von 3
Help! I'm not sure exactly how to get started on this assignment
You have been contracted to write a C++ program for a simple text-based game's battle system.
The input to your program will be a file named characterInfo.txt. The file contains five lines in
the following format:
The first line represents the hero's name (string), starting health (int), and spell/ability name
(string). The second line represents the enemy's name (string), starting health (int), and
spell/ability name (string). If any name has two or more words, the words will be connected
using underscores. Here are two examples
The second file is invalid because there's a space between "Some" and "Hero". The remaining
three lines indicate the minimum and maximum possible damage for the actions the hero and
enemy can take. You can assume that the file will always be in the correct format.
After reading the file, the program will open a file for output called battleResults.txt. A message
stating the characters' names and starting health will be printed to both the terminal window and
the file.
For example,
Next, the program will print out which character's turn it is and their health. Then the program
will display a menu with three options representing the actions each character can take. The hero
always goes first. For example,
Options 1 and 3 are the same for both characters. Option 2 must include the name of the
character's spell or ability. You can use integers (as shown above) or chars (such as 'a' for attack,
's' for spell, and 'p' for potion) for your menu options.
The user will select one of the three options. Use a switch statement to determine which option
was selected and take the following action depending on what the user chose:
Attack : Generate a random value between Min_Attack_Damageand Max_Attack_Damage and
subtract that value from the other character's health.
Spell / Ability : Generate a random value between Min_Spell/Ability_Damage and
Max_Spell/Ability_Damage and subtract that value from the other character's health.
Potion : Generate a random value between Min_Potion and Max_Potion and add that amount to
the current character's health. However, a character's current health should never exceed the
starting health listed in the file. Also, a character can use a potion a maximum of 3 times. After
that, using the potion option should have no effect other than a loss of turn for the current
character. Make sure to print a message saying that the character is out of potions in this case.
Regardless of the action selected , you must print out a message describing what happened to
both the terminal window and the file . After printing, display the menu again for the other
character's turn. See the sample output below.
Continue processing turns until one of the characters has 0 or negative health. Print out an
appropriate victory message and exit the program.
Assumptions, Other Requirements and Tips
If the file characterInfo.txt does not exist, print an appropriate error message and exit the
program. Hint: the ifstream function is_open can help here.
You can assume the file characterInfo.txt is properly formatted and the min values are strictly
less than the max values.
All terminal input must be validated. Print out an appropriate message and prompt the user to try
again if they enter an invalid value. Hint: use the functions provided in the <cctype> header:
http://www.cplusplus.com/reference/cctype/ (Links to an external site.)
Don't forget to close your files when you are done with them!
You must use a switch structure to determine which option was selected.
All messages that detail the results of an action must include the name of the character(s)
involved.
If a character's health changes as the result of an action, the new health value must also be
displayed.
All names of characters and spells will have underscores between words if they contain two or
more words.
Feel free to make the messages as humorous or silly as you want! Beware messages in poor taste
might be frowned upon by the grader.
Test your program with multiple files to make sure it can handle a variety of inputs.
Make good use of white space in your program: vertical spacing, indentation, horizontal spacing,
etc.
You may find it useful to write functions that help you do certain tasks for this program. Make
sure these functions have a clear purpose and do the tasks for a single idea. For example, don't
have one function that prints a main menu, but also does something for a potion, when those
things should each be in their own function.
Formatting, Comments, and Submission Guidelines
See Programming Assignment Guidelines. Failure to follow the guidelines will result in a loss of
credit as detailed in said guidelines.
Sample Output
Note: Your output does not have to be formatted exactly like this. As long as all the required
information is displayed, you will get credit for having the correct output. Values in bold were
input by the user.
The corresponding output file battleResults.txt would have the following lines:
Valid File Invalid File
Some_Hero 157 Fireball
Bad_Guy 250 Acid_Bomb
5 25
15 35
20 30
Some Hero 157 Fireball
Bad_Guy 250 Acid_Bomb
5 25
15 35
20 30

Weitere ähnliche Inhalte

Ähnlich wie Help! I'm not sure exactly how to get started on this assignment You h.docx

BENG 108 Final Project
BENG 108 Final ProjectBENG 108 Final Project
BENG 108 Final ProjectJason Trimble
 
C Language (All Concept)
C Language (All Concept)C Language (All Concept)
C Language (All Concept)sachindane
 
Python for Physical Science.pdf
Python for Physical Science.pdfPython for Physical Science.pdf
Python for Physical Science.pdfMarilouANDERSON
 
Hello guys please make sure program runs well USING C anyth.pdf
Hello guys please make sure program runs well USING C anyth.pdfHello guys please make sure program runs well USING C anyth.pdf
Hello guys please make sure program runs well USING C anyth.pdfactioncbe1
 
Hey i have attached the required file for my assignment.and addi
Hey i have attached the required file for my assignment.and addiHey i have attached the required file for my assignment.and addi
Hey i have attached the required file for my assignment.and addisorayan5ywschuit
 
Article link httpiveybusinessjournal.compublicationmanaging-.docx
Article link httpiveybusinessjournal.compublicationmanaging-.docxArticle link httpiveybusinessjournal.compublicationmanaging-.docx
Article link httpiveybusinessjournal.compublicationmanaging-.docxfredharris32
 
Input processing and output in Python
Input processing and output in PythonInput processing and output in Python
Input processing and output in PythonMSB Academy
 
Input processing and output in Python
Input processing and output in PythonInput processing and output in Python
Input processing and output in PythonRaajendra M
 
Format String Attack
Format String AttackFormat String Attack
Format String AttackMayur Mallya
 
Hello, I need help with the following assignmentThis assignment w.pdf
Hello, I need help with the following assignmentThis assignment w.pdfHello, I need help with the following assignmentThis assignment w.pdf
Hello, I need help with the following assignmentThis assignment w.pdfnamarta88
 
Code In PythonFile 1 main.pyYou will implement two algorithms t.pdf
Code In PythonFile 1 main.pyYou will implement two algorithms t.pdfCode In PythonFile 1 main.pyYou will implement two algorithms t.pdf
Code In PythonFile 1 main.pyYou will implement two algorithms t.pdfaishwaryaequipment
 

Ähnlich wie Help! I'm not sure exactly how to get started on this assignment You h.docx (18)

BENG 108 Final Project
BENG 108 Final ProjectBENG 108 Final Project
BENG 108 Final Project
 
C Language (All Concept)
C Language (All Concept)C Language (All Concept)
C Language (All Concept)
 
Microsoft Office
Microsoft OfficeMicrosoft Office
Microsoft Office
 
Python for Physical Science.pdf
Python for Physical Science.pdfPython for Physical Science.pdf
Python for Physical Science.pdf
 
Hello guys please make sure program runs well USING C anyth.pdf
Hello guys please make sure program runs well USING C anyth.pdfHello guys please make sure program runs well USING C anyth.pdf
Hello guys please make sure program runs well USING C anyth.pdf
 
ibuyer_Manual
ibuyer_Manualibuyer_Manual
ibuyer_Manual
 
qb unit2 solve eem201.pdf
qb unit2 solve eem201.pdfqb unit2 solve eem201.pdf
qb unit2 solve eem201.pdf
 
Hey i have attached the required file for my assignment.and addi
Hey i have attached the required file for my assignment.and addiHey i have attached the required file for my assignment.and addi
Hey i have attached the required file for my assignment.and addi
 
Tm 1st quarter - 2nd meeting
Tm   1st quarter - 2nd meetingTm   1st quarter - 2nd meeting
Tm 1st quarter - 2nd meeting
 
Article link httpiveybusinessjournal.compublicationmanaging-.docx
Article link httpiveybusinessjournal.compublicationmanaging-.docxArticle link httpiveybusinessjournal.compublicationmanaging-.docx
Article link httpiveybusinessjournal.compublicationmanaging-.docx
 
Project report
Project reportProject report
Project report
 
Input processing and output in Python
Input processing and output in PythonInput processing and output in Python
Input processing and output in Python
 
Input processing and output in Python
Input processing and output in PythonInput processing and output in Python
Input processing and output in Python
 
Format String Attack
Format String AttackFormat String Attack
Format String Attack
 
C notes for exam preparation
C notes for exam preparationC notes for exam preparation
C notes for exam preparation
 
Hello, I need help with the following assignmentThis assignment w.pdf
Hello, I need help with the following assignmentThis assignment w.pdfHello, I need help with the following assignmentThis assignment w.pdf
Hello, I need help with the following assignmentThis assignment w.pdf
 
Code In PythonFile 1 main.pyYou will implement two algorithms t.pdf
Code In PythonFile 1 main.pyYou will implement two algorithms t.pdfCode In PythonFile 1 main.pyYou will implement two algorithms t.pdf
Code In PythonFile 1 main.pyYou will implement two algorithms t.pdf
 
Sam python pro_points_slide
Sam python pro_points_slideSam python pro_points_slide
Sam python pro_points_slide
 

Mehr von Juliang56Parsonso

How is the process of recoding defined- (a) technique where the value.docx
How is the process of recoding defined- (a) technique where the value.docxHow is the process of recoding defined- (a) technique where the value.docx
How is the process of recoding defined- (a) technique where the value.docxJuliang56Parsonso
 
How is cognitive therapy different from rational-emotive therapy- Mult.docx
How is cognitive therapy different from rational-emotive therapy- Mult.docxHow is cognitive therapy different from rational-emotive therapy- Mult.docx
How is cognitive therapy different from rational-emotive therapy- Mult.docxJuliang56Parsonso
 
how has Information Systems impacted organizations- Research ways an o.docx
how has Information Systems impacted organizations- Research ways an o.docxhow has Information Systems impacted organizations- Research ways an o.docx
how has Information Systems impacted organizations- Research ways an o.docxJuliang56Parsonso
 
How is acid rain produced- CO2 molecules react with H2O molecules in t.docx
How is acid rain produced- CO2 molecules react with H2O molecules in t.docxHow is acid rain produced- CO2 molecules react with H2O molecules in t.docx
How is acid rain produced- CO2 molecules react with H2O molecules in t.docxJuliang56Parsonso
 
How Effective Managers Use Information Systems Advances in computer-ba.docx
How Effective Managers Use Information Systems Advances in computer-ba.docxHow Effective Managers Use Information Systems Advances in computer-ba.docx
How Effective Managers Use Information Systems Advances in computer-ba.docxJuliang56Parsonso
 
How do you think firms decide which type of private debts to use- Do t.docx
How do you think firms decide which type of private debts to use- Do t.docxHow do you think firms decide which type of private debts to use- Do t.docx
How do you think firms decide which type of private debts to use- Do t.docxJuliang56Parsonso
 
How does excess CO2 emission cause the reduction of coral reefs around.docx
How does excess CO2 emission cause the reduction of coral reefs around.docxHow does excess CO2 emission cause the reduction of coral reefs around.docx
How does excess CO2 emission cause the reduction of coral reefs around.docxJuliang56Parsonso
 
How do the concepts of -Cultural Relativism- and -Ethnocentrism- relat.docx
How do the concepts of -Cultural Relativism- and -Ethnocentrism- relat.docxHow do the concepts of -Cultural Relativism- and -Ethnocentrism- relat.docx
How do the concepts of -Cultural Relativism- and -Ethnocentrism- relat.docxJuliang56Parsonso
 
How do you change a column to an existing table in MS SQL Server- d- M.docx
How do you change a column to an existing table in MS SQL Server- d- M.docxHow do you change a column to an existing table in MS SQL Server- d- M.docx
How do you change a column to an existing table in MS SQL Server- d- M.docxJuliang56Parsonso
 
How do positively charged ions reach the upper portion of a thundersto.docx
How do positively charged ions reach the upper portion of a thundersto.docxHow do positively charged ions reach the upper portion of a thundersto.docx
How do positively charged ions reach the upper portion of a thundersto.docxJuliang56Parsonso
 
How do Palmer and hooks define vocation and purpose- Did they encounte.docx
How do Palmer and hooks define vocation and purpose- Did they encounte.docxHow do Palmer and hooks define vocation and purpose- Did they encounte.docx
How do Palmer and hooks define vocation and purpose- Did they encounte.docxJuliang56Parsonso
 
How do mobility barriers affect the strategy of a firm- They create is.docx
How do mobility barriers affect the strategy of a firm- They create is.docxHow do mobility barriers affect the strategy of a firm- They create is.docx
How do mobility barriers affect the strategy of a firm- They create is.docxJuliang56Parsonso
 
How do positively charged ions reach the upper portion of a thundersto (1).docx
How do positively charged ions reach the upper portion of a thundersto (1).docxHow do positively charged ions reach the upper portion of a thundersto (1).docx
How do positively charged ions reach the upper portion of a thundersto (1).docxJuliang56Parsonso
 
How do I get Main-java to compile- the program is incomplete - Need.docx
How do I get Main-java to compile- the program is  incomplete -  Need.docxHow do I get Main-java to compile- the program is  incomplete -  Need.docx
How do I get Main-java to compile- the program is incomplete - Need.docxJuliang56Parsonso
 
How can you integrate Machine learning and AI to improve security- Wha.docx
How can you integrate Machine learning and AI to improve security- Wha.docxHow can you integrate Machine learning and AI to improve security- Wha.docx
How can you integrate Machine learning and AI to improve security- Wha.docxJuliang56Parsonso
 
How do axial filaments differ from regular bacterial flagella- a- The.docx
How do axial filaments differ from regular bacterial flagella- a-  The.docxHow do axial filaments differ from regular bacterial flagella- a-  The.docx
How do axial filaments differ from regular bacterial flagella- a- The.docxJuliang56Parsonso
 
How can the money supply expand or shrink- How does the money supply r.docx
How can the money supply expand or shrink- How does the money supply r.docxHow can the money supply expand or shrink- How does the money supply r.docx
How can the money supply expand or shrink- How does the money supply r.docxJuliang56Parsonso
 
How big of a cash dividend needs to be declared to give the common sto.docx
How big of a cash dividend needs to be declared to give the common sto.docxHow big of a cash dividend needs to be declared to give the common sto.docx
How big of a cash dividend needs to be declared to give the common sto.docxJuliang56Parsonso
 
How are Mass and Matter related- None of these is the correct answer-.docx
How are Mass and Matter related- None of these is the correct answer-.docxHow are Mass and Matter related- None of these is the correct answer-.docx
How are Mass and Matter related- None of these is the correct answer-.docxJuliang56Parsonso
 
Hoperer Recwvabien Sehedile The fotowing accepints were uninterbenaly.docx
Hoperer Recwvabien Sehedile The fotowing accepints were uninterbenaly.docxHoperer Recwvabien Sehedile The fotowing accepints were uninterbenaly.docx
Hoperer Recwvabien Sehedile The fotowing accepints were uninterbenaly.docxJuliang56Parsonso
 

Mehr von Juliang56Parsonso (20)

How is the process of recoding defined- (a) technique where the value.docx
How is the process of recoding defined- (a) technique where the value.docxHow is the process of recoding defined- (a) technique where the value.docx
How is the process of recoding defined- (a) technique where the value.docx
 
How is cognitive therapy different from rational-emotive therapy- Mult.docx
How is cognitive therapy different from rational-emotive therapy- Mult.docxHow is cognitive therapy different from rational-emotive therapy- Mult.docx
How is cognitive therapy different from rational-emotive therapy- Mult.docx
 
how has Information Systems impacted organizations- Research ways an o.docx
how has Information Systems impacted organizations- Research ways an o.docxhow has Information Systems impacted organizations- Research ways an o.docx
how has Information Systems impacted organizations- Research ways an o.docx
 
How is acid rain produced- CO2 molecules react with H2O molecules in t.docx
How is acid rain produced- CO2 molecules react with H2O molecules in t.docxHow is acid rain produced- CO2 molecules react with H2O molecules in t.docx
How is acid rain produced- CO2 molecules react with H2O molecules in t.docx
 
How Effective Managers Use Information Systems Advances in computer-ba.docx
How Effective Managers Use Information Systems Advances in computer-ba.docxHow Effective Managers Use Information Systems Advances in computer-ba.docx
How Effective Managers Use Information Systems Advances in computer-ba.docx
 
How do you think firms decide which type of private debts to use- Do t.docx
How do you think firms decide which type of private debts to use- Do t.docxHow do you think firms decide which type of private debts to use- Do t.docx
How do you think firms decide which type of private debts to use- Do t.docx
 
How does excess CO2 emission cause the reduction of coral reefs around.docx
How does excess CO2 emission cause the reduction of coral reefs around.docxHow does excess CO2 emission cause the reduction of coral reefs around.docx
How does excess CO2 emission cause the reduction of coral reefs around.docx
 
How do the concepts of -Cultural Relativism- and -Ethnocentrism- relat.docx
How do the concepts of -Cultural Relativism- and -Ethnocentrism- relat.docxHow do the concepts of -Cultural Relativism- and -Ethnocentrism- relat.docx
How do the concepts of -Cultural Relativism- and -Ethnocentrism- relat.docx
 
How do you change a column to an existing table in MS SQL Server- d- M.docx
How do you change a column to an existing table in MS SQL Server- d- M.docxHow do you change a column to an existing table in MS SQL Server- d- M.docx
How do you change a column to an existing table in MS SQL Server- d- M.docx
 
How do positively charged ions reach the upper portion of a thundersto.docx
How do positively charged ions reach the upper portion of a thundersto.docxHow do positively charged ions reach the upper portion of a thundersto.docx
How do positively charged ions reach the upper portion of a thundersto.docx
 
How do Palmer and hooks define vocation and purpose- Did they encounte.docx
How do Palmer and hooks define vocation and purpose- Did they encounte.docxHow do Palmer and hooks define vocation and purpose- Did they encounte.docx
How do Palmer and hooks define vocation and purpose- Did they encounte.docx
 
How do mobility barriers affect the strategy of a firm- They create is.docx
How do mobility barriers affect the strategy of a firm- They create is.docxHow do mobility barriers affect the strategy of a firm- They create is.docx
How do mobility barriers affect the strategy of a firm- They create is.docx
 
How do positively charged ions reach the upper portion of a thundersto (1).docx
How do positively charged ions reach the upper portion of a thundersto (1).docxHow do positively charged ions reach the upper portion of a thundersto (1).docx
How do positively charged ions reach the upper portion of a thundersto (1).docx
 
How do I get Main-java to compile- the program is incomplete - Need.docx
How do I get Main-java to compile- the program is  incomplete -  Need.docxHow do I get Main-java to compile- the program is  incomplete -  Need.docx
How do I get Main-java to compile- the program is incomplete - Need.docx
 
How can you integrate Machine learning and AI to improve security- Wha.docx
How can you integrate Machine learning and AI to improve security- Wha.docxHow can you integrate Machine learning and AI to improve security- Wha.docx
How can you integrate Machine learning and AI to improve security- Wha.docx
 
How do axial filaments differ from regular bacterial flagella- a- The.docx
How do axial filaments differ from regular bacterial flagella- a-  The.docxHow do axial filaments differ from regular bacterial flagella- a-  The.docx
How do axial filaments differ from regular bacterial flagella- a- The.docx
 
How can the money supply expand or shrink- How does the money supply r.docx
How can the money supply expand or shrink- How does the money supply r.docxHow can the money supply expand or shrink- How does the money supply r.docx
How can the money supply expand or shrink- How does the money supply r.docx
 
How big of a cash dividend needs to be declared to give the common sto.docx
How big of a cash dividend needs to be declared to give the common sto.docxHow big of a cash dividend needs to be declared to give the common sto.docx
How big of a cash dividend needs to be declared to give the common sto.docx
 
How are Mass and Matter related- None of these is the correct answer-.docx
How are Mass and Matter related- None of these is the correct answer-.docxHow are Mass and Matter related- None of these is the correct answer-.docx
How are Mass and Matter related- None of these is the correct answer-.docx
 
Hoperer Recwvabien Sehedile The fotowing accepints were uninterbenaly.docx
Hoperer Recwvabien Sehedile The fotowing accepints were uninterbenaly.docxHoperer Recwvabien Sehedile The fotowing accepints were uninterbenaly.docx
Hoperer Recwvabien Sehedile The fotowing accepints were uninterbenaly.docx
 

Kürzlich hochgeladen

Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseAnaAcapella
 
Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxMagic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxdhanalakshmis0310
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxAmanpreet Kaur
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 

Kürzlich hochgeladen (20)

Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxMagic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 

Help! I'm not sure exactly how to get started on this assignment You h.docx

  • 1. Help! I'm not sure exactly how to get started on this assignment You have been contracted to write a C++ program for a simple text-based game's battle system. The input to your program will be a file named characterInfo.txt. The file contains five lines in the following format: The first line represents the hero's name (string), starting health (int), and spell/ability name (string). The second line represents the enemy's name (string), starting health (int), and spell/ability name (string). If any name has two or more words, the words will be connected using underscores. Here are two examples The second file is invalid because there's a space between "Some" and "Hero". The remaining three lines indicate the minimum and maximum possible damage for the actions the hero and enemy can take. You can assume that the file will always be in the correct format. After reading the file, the program will open a file for output called battleResults.txt. A message stating the characters' names and starting health will be printed to both the terminal window and the file. For example, Next, the program will print out which character's turn it is and their health. Then the program will display a menu with three options representing the actions each character can take. The hero always goes first. For example, Options 1 and 3 are the same for both characters. Option 2 must include the name of the character's spell or ability. You can use integers (as shown above) or chars (such as 'a' for attack, 's' for spell, and 'p' for potion) for your menu options. The user will select one of the three options. Use a switch statement to determine which option was selected and take the following action depending on what the user chose: Attack : Generate a random value between Min_Attack_Damageand Max_Attack_Damage and subtract that value from the other character's health. Spell / Ability : Generate a random value between Min_Spell/Ability_Damage and Max_Spell/Ability_Damage and subtract that value from the other character's health. Potion : Generate a random value between Min_Potion and Max_Potion and add that amount to the current character's health. However, a character's current health should never exceed the starting health listed in the file. Also, a character can use a potion a maximum of 3 times. After that, using the potion option should have no effect other than a loss of turn for the current character. Make sure to print a message saying that the character is out of potions in this case.
  • 2. Regardless of the action selected , you must print out a message describing what happened to both the terminal window and the file . After printing, display the menu again for the other character's turn. See the sample output below. Continue processing turns until one of the characters has 0 or negative health. Print out an appropriate victory message and exit the program. Assumptions, Other Requirements and Tips If the file characterInfo.txt does not exist, print an appropriate error message and exit the program. Hint: the ifstream function is_open can help here. You can assume the file characterInfo.txt is properly formatted and the min values are strictly less than the max values. All terminal input must be validated. Print out an appropriate message and prompt the user to try again if they enter an invalid value. Hint: use the functions provided in the <cctype> header: http://www.cplusplus.com/reference/cctype/ (Links to an external site.) Don't forget to close your files when you are done with them! You must use a switch structure to determine which option was selected. All messages that detail the results of an action must include the name of the character(s) involved. If a character's health changes as the result of an action, the new health value must also be displayed. All names of characters and spells will have underscores between words if they contain two or more words. Feel free to make the messages as humorous or silly as you want! Beware messages in poor taste might be frowned upon by the grader. Test your program with multiple files to make sure it can handle a variety of inputs. Make good use of white space in your program: vertical spacing, indentation, horizontal spacing, etc. You may find it useful to write functions that help you do certain tasks for this program. Make sure these functions have a clear purpose and do the tasks for a single idea. For example, don't have one function that prints a main menu, but also does something for a potion, when those things should each be in their own function. Formatting, Comments, and Submission Guidelines
  • 3. See Programming Assignment Guidelines. Failure to follow the guidelines will result in a loss of credit as detailed in said guidelines. Sample Output Note: Your output does not have to be formatted exactly like this. As long as all the required information is displayed, you will get credit for having the correct output. Values in bold were input by the user. The corresponding output file battleResults.txt would have the following lines: Valid File Invalid File Some_Hero 157 Fireball Bad_Guy 250 Acid_Bomb 5 25 15 35 20 30 Some Hero 157 Fireball Bad_Guy 250 Acid_Bomb 5 25 15 35 20 30