SlideShare uma empresa Scribd logo
1 de 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

Mais conteúdo relacionado

Semelhante a 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
 

Semelhante a 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
 

Mais de 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
 

Mais de 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
 

Último

Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Shubhangi Sonawane
 
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
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfChris Hunter
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...KokoStevan
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
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
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 

Último (20)

Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
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
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
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
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 

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