I need some help with my code.
I keep getting error codes whenever I compile but I'm not understanding it. Would anyone be willing to help?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
#include <cstdlib>
#include <iostream>
#include <time.h>
using namespace std;
time_t now;
time(&now);
srand(now);
rand();
class Sword {
public:
void Cut ( health ) {
health -= rand() % 6;
}
};
int main(int argc, char *argv[])
{
Sword Player1;
int health = 100;
Player1.Cut ( health );
cout<< health <<endl;
system("PAUSE");
return EXIT_SUCCESS;
}
|
Put line 7-10 inside the main() function.
Topic archived. No new replies allowed.