Advertisement
Guest User

Errors c++ class

a guest
Apr 12th, 2014
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.28 KB | None | 0 0
  1. #ifndef PKMN_H
  2. #define PKMN_H
  3. #include <iostream>
  4. #include <iomanip>
  5. #include <string>
  6. #include <cmath>
  7. enum TYPING {NIL, NORMAL, FIGHT, FLYING, POISON, GROUND, ROCK, BUG, GHOST, STEEL, FIRE, WATER, GRASS, ELECTR, PSYCHC, ICE, DRAGON, DARK, FAIRY};
  8. //-STAT ATT DEF Speed SPA SPDef
  9. enum NATURE {HAR, LON, BRV, ADA, NAU, //+STAT Attack
  10. BOL, DOC, REL, IMP, LAX, // Defense
  11. TIM, HAS, SER, JOL, NAI, // Speed
  12. MOD, MIL, QUI, BSH, RSH, // Special Attack
  13. CLM, GEN, SAS, CAR, QUR}; // Special Defense
  14. /* These values stand for:
  15. Hardy, Lonely, Brave, Adamant, Naughty
  16. Bold, Docile, Relaxed, Impish, Lax
  17. Timid, Hasty, Serious, Jolly, Naive
  18. Modest, Mild, Quiet, Bashful, Rash
  19. Calm, Gentle, Sassy, Careful, Quirky*/
  20. double getEffectiveness (TYPING, TYPING);
  21. class pkmn
  22. {
  23. string myName;
  24. string myurl;
  25. int maxHP;
  26. int curHP;
  27. int curEn;
  28. int att;
  29. int def;
  30. int spa;
  31. int spd;
  32. int spe;
  33. NATURE nat;
  34. public:
  35. void printData(void);
  36. pkmn(void);
  37. };
  38. pkmn::pkmn()
  39. {
  40. myName="Bulbasaur";
  41. myurl="http:////veekun.com//dex//media//pokemon//main-sprites//black-white//1.png";
  42. maxHP=80;
  43. curHP=maxHP;
  44. curEn=100;
  45. att=0;
  46. def=0;
  47. spa=0;
  48. spd=0;
  49. spe=0;
  50. }
  51. void pkmn::printData()
  52. {
  53. //cout << "printing data for " << myName << ".\n";
  54. //cout << "[url=" << myUrl << "]" << myName << "[/url]\n";
  55. //cout << myName << endl;
  56. cout << "HP: " << curHP << "/" << maxHP << endl;
  57. cout << "EN: " << curEn << "/100\n";
  58. }
  59.  
  60. double getTypeEffectiveness(TYPING attack, TYPING defend)
  61. {
  62. double gTEvar = 0;
  63. int effective[18][18] = {
  64. {0, 0, 0, 0, 0,-1, 0, 7,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0}, //normal
  65. {1, 0,-1,-1, 0, 1,-1, 7, 1, 0, 0, 0, 0,-1, 0, 0, 0, 0}, //fight
  66. {0, 1, 0, 0, 0,-1, 1, 0,-1, 0, 0, 1,-1, 0, 0, 0, 0, 0}, //flying
  67. {0, 0, 0,-1,-1,-1, 0,-1, 7, 0, 0, 1, 0, 0, 0, 0, 0, 1}, //poison
  68. {0, 0, 7, 1, 0, 1,-1, 0, 1, 1, 0,-1, 1, 0, 0, 0, 0, 0}, //ground
  69. {0,-1, 1, 0,-1, 0, 1, 0,-1, 1, 0, 0, 0, 0, 1, 0, 0, 0}, //rock
  70. {0,-1,-1,-1, 0, 0, 0,-1,-1,-1, 0, 1, 0, 1, 0, 0, 1,-1}, //bug
  71. {7, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0,-1, 1}, //ghost
  72. {0, 0, 0, 0, 0, 1, 0, 0,-1,-1,-1, 0,-1, 0, 1, 0, 0, 1}, //steel
  73. {0, 0, 0, 0, 0,-1, 1, 0, 1,-1,-1, 1, 0, 0, 1,-1, 0, 0}, //fire
  74. {0, 0, 0, 0, 1, 1, 0, 0, 0, 1,-1,-1, 0, 0, 0,-1, 0, 0}, //water
  75. {0, 0,-1,-1, 1, 1,-1, 0,-1,-1, 1,-1, 0, 0, 0,-1, 0, 0}, //grass
  76. {0, 0, 1, 0, 7, 0, 0, 0, 0, 0, 1,-1,-1, 0, 0,-1, 0, 0}, //electric
  77. {0, 1, 0, 1, 0, 0, 0, 0,-1, 0, 0, 0, 0,-1, 0, 0, 7, 0}, //psychic
  78. {0, 0, 1, 0, 1, 0, 0, 0,-1,-1,-1, 1, 0, 0,-1, 1, 0, 0}, //ice
  79. {0, 0, 0, 0, 0, 0, 0, 0,-1, 0, 0, 0, 0, 0, 0, 1, 0, 7}, //dragon
  80. {0,-1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0,-1,-1}, //dark
  81. {0, 1, 0,-1, 0, 0, 0, 0,-1,-1, 0, 0, 0, 0, 0, 1, 1, 0}};//fairy
  82. // n f f p g r b g s f w g e p i d d f
  83. // o i l o r o u h t i a r l s c r a a
  84. // r g y i o c g o e r t a e y e a r i
  85. // m h s u k s e e e s c c g k r
  86. // a t o n t l r s t h o y
  87. // l n d r c n
  88. if (attack==NIL||defend==NIL)
  89. return 0;
  90. else
  91. gTEvar = effective[static_cast<TYPING>(attack-1)][static_cast<TYPING>(defend-1)];
  92. if (gTEvar==7)
  93. return 0;
  94. else
  95. return pow(1.5, gTEvar);
  96. }
  97. #endif
  98.  
  99. ---------
  100. //error message
  101. 1>------ Build started: Project: Pokemon API 2010, Configuration: Debug Win32 ------
  102. 1> Driver.cpp
  103. 1>e:\programs\damage calculator\damage calculator\pokemon.h(23): error C2146: syntax error : missing ';' before identifier 'myName'
  104. 1>e:\programs\damage calculator\damage calculator\pokemon.h(23): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
  105. 1>e:\programs\damage calculator\damage calculator\pokemon.h(23): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
  106. 1>e:\programs\damage calculator\damage calculator\pokemon.h(24): error C2146: syntax error : missing ';' before identifier 'myurl'
  107. 1>e:\programs\damage calculator\damage calculator\pokemon.h(24): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
  108. 1>e:\programs\damage calculator\damage calculator\pokemon.h(24): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
  109. 1>e:\programs\damage calculator\damage calculator\pokemon.h(40): error C2065: 'myName' : undeclared identifier
  110. 1>e:\programs\damage calculator\damage calculator\pokemon.h(41): error C2065: 'myurl' : undeclared identifier
  111. 1>e:\programs\damage calculator\damage calculator\pokemon.h(51): error C2653: 'pkmn' : is not a class or namespace name
  112. 1>e:\programs\damage calculator\damage calculator\pokemon.h(56): error C2065: 'cout' : undeclared identifier
  113. 1>e:\programs\damage calculator\damage calculator\pokemon.h(56): error C2065: 'curHP' : undeclared identifier
  114. 1>e:\programs\damage calculator\damage calculator\pokemon.h(56): error C2065: 'maxHP' : undeclared identifier
  115. 1>e:\programs\damage calculator\damage calculator\pokemon.h(56): error C2065: 'endl' : undeclared identifier
  116. 1>e:\programs\damage calculator\damage calculator\pokemon.h(57): error C2065: 'cout' : undeclared identifier
  117. 1>e:\programs\damage calculator\damage calculator\pokemon.h(57): error C2065: 'curEn' : undeclared identifier
  118. ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement