no time

i have no time to do this and i have no idea how to separate the parameters to get this to work. if someone finds this to be an easy project can you please do this for me, i would greatly appreciate it.

///////////////////////////////////////////////

Stub functions, like pseudo code can be a powerful design tool. Stub functions are placeholder functions for a real one to be written later. Often they just output text.

Write a program that asks the user how many times he wants the dragon to attack. Store the user’s input in number in an unsigned short variable.

Next you will create (prototype and define) 5 void functions with no arguments: Dragon, DragonBite, DragonHorns, DragonTail, and DragonBreath. Note you *must* use the exact case and spelling shown here in your functions.

Important – I want the function prototype or declaration above the main() function and after the using namespace std; I want the function definitions (actual code) below the closing brace in main().

The Dragon function should be called in a for loop in main() that loops the number of times the user wants the dragon to attack, ie user input 5 then there are five loops and five calls to the Dragon function. You should seed the random number generator in main(). Note the safest place to seed srand is always the first line in main().

The Dragon function will call the other functions DragonBite, DragonHorns, DragonTail and DragonBreath as follows: Generate a random number between 1 and 100 inside the Dragon function and, then using an if ladder for 1-30 call the DragonBite function, 31-55 call DragonHorns, 56-80 call DragonTail and 81 or higher call DragonBreath. To be clear, the user sets the number of loops, the for loop calls Dragon, which generates a random number to determine which one of the of the dragon attack functions to call. We are nesting functions here. See the sample output below, each line is a loop iteration.

DragonBite is a stub function that just outputs: “The dragon bites you!”

DragonHorns is a stub function that just outputs: “The dragon gores you with its horns!”

DragonTail is a stub function that just outputs: “The dragon slaps you with its tail!”

DragonBreath is a stub function that just outputs: “The dragon breaths fire on you!”

Input – One small positive integer.
Process - Determine the number of attacks. In a loop call the Dragon function. In Dragon determine which dragon attack function to call and do so.
Output – The result of each dragon attack.

Sample input and output if the user enters 8 below. Obviously the attacks generated for you will be different if you use rand and srand properly.

Please enter the number of times you want the dragon to attack: 8

The dragon slaps you with its tail!

The dragon slaps you with its tail!

The dragon bites you!

The dragon breaths fire on you!

The dragon gores you with its horns!

The dragon bites you!

The dragon breaths fire on you!

The dragon bites you!

Press any key to continue . . .
Looks like homework. Why don't you try allocating more time to learning the material instead of giving up? From what I can see, the homework literally only involves one function that takes an unsigned short parameter, as the rest of the functions are just containers for cout statements.

Also the hardest thing you have to pay attention to is your if statements.
Last edited on
so i did it, i have an amazing amount of error and i have no idea what a handful of them even mean.


#include <iostream>
#include <ctime>

using namespace std;
void DragonBite();
void DragonHorn();
void DragonTail();
void DragonBreath();

int main()
{

cout << "Please enter the number of times you want the dagon to attack you: " << count << endl;
cin >> count >> endl;
(int count = 1; count < 100; count++)
}
{
for (int count = 1; count < 31; count++)
{
DragonBite();
return 0;
}

void DragonBite();

cout << " The Dragon bites you " << endl;
}
void DragonBite();
{
for (int count = 32; count < 55; count++)
{
DragonHorn();
return 0;
}
void DragonHorn() {
cout << " The Dragon gores you with his horn! " << endl;
}
{

void DragonHorn();
}
{
for (int count = 56; count < 80; count++)
{
DragonTail();
return 0;
}
void DragonTail() {
cout << " Dragon slaps you with his tail! " << endl;
}
{

void DragonTail();
}
{
for (int count = 81; count < 100; count++)
{
DragonBreath();
return 0;
}
void DragonBreath() {
cout << " Dragon breathes fire on you! " << endl;
}
{

void DragonBreath();
}







Bro, you're gonna have to start using code tags or people are going to start ignoring your pleas for help.
http://www.cplusplus.com/articles/jEywvCM9/

Anyways, what you're going to need to really buckle down and learn are:

syntax of
-declaring function prototypes and defining their bodies
1
2
3
void DragonHorn();
}
{


-for loops
(int count = 1; count < 100; count++)

-cin statements
cin >> count >> endl;

-curly brace placements (you have them all over the place)
1
2
}
{


There is also the issue of using <ctime> when your program looks like it never needs to ever call any function from the <ctime> library. If your professor(s) are telling you to use a library that's never going to have anything pulled out of it, they are bad and they should feel bad. However, if you're including it because that's how the professor does it in their examples or something, I won't blame you. But try not to include anything that is never going to be used in one of your programs in the future.

EDIT: I thought 3 bars would look cool. Guess not.
Last edited on
Topic archived. No new replies allowed.