declaration syntax error?

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Feb 2005
Posts: 84
Reputation: evilsilver is an unknown quantity at this point 
Solved Threads: 1
evilsilver's Avatar
evilsilver evilsilver is offline Offline
Junior Poster in Training

declaration syntax error?

 
0
  #1
Feb 5th, 2005
ok guys heres the problem (by the way i am a beginner programmer so don't laugh at the code lol) i keep getting this declaration syntax error whenever i try to compile this program (i also get a declarations missing; and compound statement missing} ) but everything in my code apears alright to me. so here is the code i got so far, maybe you guys can fix it.


  1. #pragma hdrstop
  2. #include <condefs.h>
  3. #include <iostream.h>
  4. #include <conio.h>
  5. #include <stdlib.h>
  6.  
  7. //---------------------------------------------------------------------------
  8. #pragma argsused
  9. void attack (int & hp, int dammage, int def, int & chp, int cdammage, char *name, int & gp, int cgp, int & nextlevel, int & exp, int cxp);
  10. void usepotion (int & lvl1potions, int & lvl2potions, int & lvl3potions, int & demonpotions, int & hp, char *name, int maxhp);
  11. void battle (int & hp, int & gp, int & exp, int & agilitylvl, int & lvl1potions, int & lvl2potions, int & lvl3potions, int & demonpotions, int dammage, int def, int chp, int cgp, int cdammage, int cexp,char *name, int & nextlevel, int & maxhp, char *nextweapon, int & blocked, int & level);
  12. int main(int argc, char **argv)
  13. {
  14. // charecter stuff
  15. int maxhp;
  16. int hp;
  17. int gp=120;
  18. int exp=0;
  19. int nextlevel=80;
  20. int level=1;
  21. int agilitylvl=0;
  22. int def=0;
  23. int dammage;
  24. // items
  25. int lvl1potions=0;
  26. int lvl2potions=0;
  27. int lvl3potions=0;
  28. int demonpotions=0;
  29. int secretitems=0;
  30. // misc
  31. int score=0;
  32. int charecter;
  33. int hplost;
  34. int gameplaychoice;
  35. int choice;
  36. int blocked;
  37.  
  38. cout << "A role playing game by Nate Nelson" << endl << endl;
  39. cout << "choose your character" << endl;
  40. cout << "1: Barbarian" << endl;
  41. cout << "2: Wizard of The Old Teachings" << endl;
  42. cout << "3: Gnome" << endl << endl;
  43. cin >> charecter;
  44. if (charecter == 1){
  45. cout << "You have chosen the nobelist and fiercest warrior in all the land, Abdazar!" << endl;
  46. cout << "the time has now come to choose you mode of battle." << endl << endl;
  47. cout << "Press any key to continue..." << endl << endl;
  48. getch();
  49. cout << "1: I would like to fight with a Giant Axe." << endl;
  50. cout << "2: I would like to fight with a Sword and Shield." << endl;
  51. cin >> choice;
  52. if (choice == 1){
  53. hp = 50;
  54. maxhp = 50;
  55. def = 2;
  56. cout << "Your weapon shall be an Axe like tree root." << endl << endl;
  57. cout << "As your adventure begins you decide to randomly choose a direction" << endl;
  58. cout << "You have stumbled upon a Goblin Warrior, he has spoted you and" << endl;
  59. cout << "wishes to fight!" << endl;
  60. cout << "You Valiantly fight the monster for your life." << endl << endl;
  61. //this is where battle sounds or music is played
  62. dammage = 10;
  63. int goblinhp = 20;
  64. int goblinexp = 20;
  65. int goblingp = 20;
  66. hplost = hp;
  67. goblinhp = goblinhp-10;
  68. hp = hp-5+2;
  69. goblinhp = goblinhp-10;
  70. hp = hp-5+2;
  71. hplost = hplost-hp;
  72. gp = gp+goblingp;
  73. hp = hp+5;
  74. exp = exp + goblinexp;
  75. cout << "you have fought valiently and killed the beast!" << endl;
  76. cout << "your Hit points are now at " << hp << "." << endl;
  77. cout << "you lost " << hplost << " hit points, but gain " << "5" << " life back from a potion the goblin had." << endl;
  78. cout << "you have gained " << exp << "/" << nextlevel << " till your next level." << endl;
  79. cout << "you have gained " << goblingp << " GP from the goblin. Your GP is at " << gp << "." << endl << endl;
  80. getch();
  81. cout << "What would you like to do now then?" << endl << endl;
  82. cout << "1: Wander aimlessly some more (fight)." << endl;
  83. cout << "2: Go East to Falador." << endl << endl;
  84. cin >> gameplaychoice;
  85. if (gameplaychoice == 1){
  86. //2nd attack
  87. cout << "As you wander aimlessly around a goblin spots you and attacks!" << endl << endl;
  88. battle (hp, gp, exp, agilitylvl, lvl1potions, lvl2potions, lvl3potions, demonpotions, dammage, def, 20, 20, 5, 20, "goblin", nextlevel, maxhp, "large stick with a sharp rock tied to the end of it", 0, level);
  89. cout << "What would you like to do now then?" << endl << endl;
  90. cout << "1: Wander aimlessly some more (fight)." << endl;
  91. cout << "2: Go East to Falador." << endl << endl;
  92. cin >> gameplaychoice;
  93. }
  94. if (gameplaychoice == 1){
  95. //3rd attack
  96. cout << "As you wander aimlessly around a goblin spots you and attacks!" << endl << endl;
  97. battle (hp, gp, exp, agilitylvl, lvl1potions, lvl2potions, lvl3potions, demonpotions, dammage, def, 20, 20, 5, 20, "goblin", nextlevel, maxhp, "large stick with a sharp rock tied to the end of it", 0, level);
  98. cout << "What would you like to do now then?" << endl << endl;
  99. cout << "1: Wander aimlessly some more (fight)." << endl;
  100. cout << "2: Go East to Falador." << endl << endl;
  101. cin >> gameplaychoice;
  102. }
  103. if (gameplaychoice == 1){
  104. //4th attack
  105. cout << "As you wander aimlessly around a goblin spots you and attacks!" << endl << endl;
  106. battle (hp, gp, exp, agilitylvl, lvl1potions, lvl2potions, lvl3potions, demonpotions, dammage, def, 20, 20, 5, 20, "goblin", nextlevel, maxhp, "large stick with a sharp rock tied to the end of it", 0, level);
  107. cout << "What would you like to do now then?" << endl << endl;
  108. cout << "1: Wander aimlessly some more (fight)." << endl;
  109. cout << "2: Go East to Falador." << endl << endl;
  110. cin >> gameplaychoice;
  111. }
  112. else if (gameplaychoice >= 2) {
  113. cout << "Goblin Warlord: I hear you have been harrassing my goblin troops!" << endl << endl;
  114. cout << "Abdazar: yeah i have been training with your troops, but i haven't been Harrassing them!" << endl << endl;
  115. cout << "Goblin Warlord: That's not the way I heard it, prepare yourself for revenge!" << endl << endl;
  116. cout << "Abdazar: Alright if it is a battle you want, a battle you shall have." << endl << endl;
  117. battle (hp, gp, exp, agilitylvl, lvl1potions, lvl2potions, lvl3potions, demonpotions, dammage, def, 200, 200, 14, 200, "goblin", nextlevel, maxhp, "large stick with a sharp rock tied to the end of it", 0, level);
  118.  
  119. }
  120. }
  121. getch ();
  122.  
  123. }
  124. return 0;
  125. }
  126. void battle (int & hp, int & gp, int & exp, int & agilitylvl, int & lvl1potions, int & lvl2potions, int & lvl3potions, int & demonpotions, int dammage, int def, int chp, int cgp, int cdammage, int cexp,char *name, int & nextlevel, int & maxhp, char *nextweapon, int & blocked, int & level)
  127. {
  128. int choice;
  129. int blockyesno;
  130. int attackedxtimes=0;
  131. cout << "what should i do?" << endl << endl;
  132. cout << "1: Attack" << endl;
  133. cout << "2: Use potion" << endl;
  134. cout << "3: Attempt to block" << endl;
  135. cin >> choice;
  136. if (choice == 1){
  137. attackedxtimes++;
  138. if (attackedxtimes != (2 || 5)){
  139. if (attackedxtimes != (3 || 6)){
  140. if (chp && hp > 0){
  141. battle (hp, gp, exp, agilitylvl, lvl1potions, lvl2potions, lvl3potions, demonpotions, dammage, def, chp, cgp, cdammage, cexp, name, nextlevel, maxhp, "large stick with a sharp rock tied to the end of it", 0, level);
  142. }
  143. }
  144.  
  145. }
  146. else if (attackedxtimes == (2 || 5)) {
  147. if (chp && hp > 0){
  148. battle (hp, gp, exp, agilitylvl, lvl1potions, lvl2potions, lvl3potions, demonpotions, dammage, def, chp, cgp, cdammage, cexp, name, nextlevel, maxhp, "large stick with a sharp rock tied to the end of it", 0, level);
  149. }
  150. cout << name << " apears to be getting ready for some sort of special attack." << endl << endl;
  151. }
  152. else if (attackedxtimes == (3 || 6)) {
  153. if (chp && hp > 0){
  154. battle (hp, gp, exp, agilitylvl, lvl1potions, lvl2potions, lvl3potions, demonpotions, dammage, def, chp, cgp, cdammage, cexp, name, nextlevel, maxhp, "large stick with a sharp rock tied to the end of it", 0, level);
  155. }
  156.  
  157. }
  158. else if (choice == 2){
  159.  
  160. usepotion (lvl1potions, lvl2potions, lvl3potions, demonpotions, hp, name, maxhp);
  161. if (chp && hp > 0){
  162. battle (hp, gp, exp, agilitylvl, lvl1potions, lvl2potions, lvl3potions, demonpotions, dammage, def, chp, cgp, cdammage, cexp, name, nextlevel, maxhp, "large stick with a sharp rock tied to the end of it", 0, level);
  163. }
  164. }
  165. else if (choice == 3){
  166. blockyesno = rand() % 100 + 1;
  167. blocked++;
  168. if (blockyesno <= (agilitylvl*10)){
  169. cout << "all dammage was successfully blocked this turn!" << endl << endl;
  170. cout << "Abdazar" << " " << name << endl;
  171. cout << hp << " " << chp << endl << endl;
  172. battle (hp, gp, exp, agilitylvl, lvl1potions, lvl2potions, lvl3potions, demonpotions, dammage, def, chp, cgp, cdammage, cexp, name, nextlevel, maxhp, "large stick with a sharp rock tied to the end of it", 0, level);
  173. getch();
  174. }
  175. else if (blockyesno >= ((agilitylvl*10)+1)){
  176. cout << "you accedentally take a wrong step as you attempt to block and still take" << endl <<" dammage."<< endl << endl;
  177. hp = hp - cdammage;
  178. cout << "Abdazar" << " " << name << endl;
  179. cout << hp << " " << chp << endl << endl;
  180. getch();
  181. battle (hp, gp, exp, agilitylvl, lvl1potions, lvl2potions, lvl3potions, demonpotions, dammage, def, chp, cgp, cdammage, cexp, name, nextlevel, maxhp, "large stick with a sharp rock tied to the end of it", 0, level);
  182. }
  183.  
  184. }
  185. if (exp == nextlevel) {
  186. cout << "you have gained enough expierience to level up!!!" << endl << endl;
  187. maxhp = maxhp * 1.5;
  188. def = def + 3;
  189. hp = maxhp;
  190. agilitylvl++;
  191. dammage = dammage+5;
  192. cout << "your max hp is now " << maxhp << endl;
  193. cout << "your defense is now " << def << endl;
  194. cout << "your agility level is now " << agilitylvl << endl;
  195. cout << "you find a new weapon on " << name << ". you decide to use this instead of your old weapon." << endl;
  196. cout << "your weapon shall now be a " << nextweapon << endl << endl;
  197. level++;
  198. }
  199.  
  200.  
  201.  
  202.  
  203.  
  204. }
  205.  
  206. void usepotion (int & lvl1potions, int & lvl2potions, int & lvl3potions, int & demonpotions, int & hp, char *name, int maxhp)
  207. { //it says the declaration syntax error is here
  208. int potionchoice;
  209. if (lvl1potions == 0) {
  210. if (lvl2potions == 0){
  211. if (lvl3potions ==0){
  212. if (demonpotions == 0){
  213. cout << "you have no potions, quick pick a battle move before " << name << " attacks you!" << endl;
  214. return ;
  215. }
  216. }
  217. }
  218. }
  219. cout << "Use which potion?" << endl << endl;
  220. if (lvl1potions >= 1) {
  221. cout << "1: level 1 potion" << endl;
  222. }
  223. if (lvl2potions >= 1){
  224. cout << "2: level 2 potion" << endl;
  225. }
  226. if (lvl3potions >= 1) {
  227. cout << "3: level 3 potion" << endl;
  228. }
  229. if (demonpotions >= 1) {
  230. cout << "4: Demonic potion" << endl;
  231. }
  232. cin >> potionchoice;
  233. if (potionchoice == 1) {
  234. lvl1potions = lvl1potions-1;
  235. hp = hp + 20;
  236. cout << "you have gained 20 hp, your hp is now at " << hp << endl << endl;
  237. if (hp > maxhp ){
  238. hp = maxhp;
  239. }
  240. }
  241. else if (potionchoice == 2) {
  242. lvl2potions = lvl2potions - 1;
  243. hp = hp + 30;
  244. cout << "you have gained 30 hp, your hp is now at " << hp << endl << endl;
  245. if (hp > maxhp ){
  246. hp = maxhp;
  247. }
  248. }
  249. else if (potionchoice == 3) {
  250. lvl3potions = lvl3potions - 1;
  251. hp = hp + 40;
  252. cout << "you have gained 40 hp, your hp is now at " << hp << endl << endl;
  253. if (hp > maxhp ){
  254. hp = maxhp;
  255. }
  256. }
  257. else if (potionchoice == 4) {
  258. demonpotions = demonpotions - 1;
  259. hp = hp + 120;
  260. cout << "you have gained 120 hp, you hp is now at " << hp << endl << endl;
  261. if (hp > maxhp ){
  262. hp = maxhp;
  263. }
  264. }
  265.  
  266. }
  267.  
  268. void attack (int & hp, int dammage, int def, int & chp, int cdammage, char *name, int & gp, int cgp, int & nextlevel, int & exp, int cxp)
  269. {
  270. int hplost;
  271. hplost = hp + def;
  272. chp = chp - dammage;
  273. int won;
  274. if (chp <= 0 ) {
  275. won = 1;
  276. cout << "You are victorious!!!" << endl << endl;
  277. exp = exp + 20;
  278. hplost = hplost - hp;
  279. hp = hp + cdammage;
  280. gp = gp + cgp;
  281. cout << "you lost " << hplost << " hit points, but gain " << cdammage << " life back from a potion the " << name << " had." << endl;
  282. cout << "your Hit points are now at " << hp << "." << endl;
  283. cout << "you have gained " << exp << "/" << nextlevel << " till your next level." << endl;
  284. cout << "you have gained " << cgp << " GP from the " << name << ". Your GP is at " << gp << "." << endl << endl;
  285. }
  286. hp = hp - cdammage;
  287. if (hp <= 0 ) {
  288. exp = exp + cxp;
  289. hplost = hplost - hp;
  290. cout << "you lost " << hplost << " hit points, but gain " << cdammage << " life back from a potion the " << name << " had." << endl;
  291. cout << "your Hit points are now at " << hp << "." << endl;
  292. cout << "you have gained " << exp << "/" << nextlevel << " till your next level." << endl;
  293. cout << "you have gained " << cgp << " GP from the goblin. Your GP is at " << gp << "." << endl << endl;
  294.  
  295. getch();
  296. }
  297. if (won == 1) {
  298. hp = hp + cdammage;
  299. }
  300. cout << "Abdazar" << " " << name << endl;
  301. cout << hp << " " << chp << endl << endl;
  302.  
  303. }
  304. // points both missing statements (; and } ) to after the program (empty lines).
Last edited by evilsilver; Feb 5th, 2005 at 2:32 pm. Reason: to subscribe (can't find another way to subscribe to this thread)
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 84
Reputation: evilsilver is an unknown quantity at this point 
Solved Threads: 1
evilsilver's Avatar
evilsilver evilsilver is offline Offline
Junior Poster in Training

Re: declaration syntax error?

 
0
  #2
Feb 5th, 2005
thought i would add that i run in windows, and use a program called Borland C++ Builder 3. (dunno if this will help you see the problem any better.)
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 4,335
Reputation: Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future 
Solved Threads: 236
Team Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: declaration syntax error?

 
0
  #3
Feb 5th, 2005
Poor indentation strikes again!

The function battle() appears to be missing a closing }.
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 84
Reputation: evilsilver is an unknown quantity at this point 
Solved Threads: 1
evilsilver's Avatar
evilsilver evilsilver is offline Offline
Junior Poster in Training

Re: declaration syntax error?

 
0
  #4
Feb 5th, 2005
Originally Posted by Dave Sinkula
Poor indentation strikes again!

The function battle() appears to be missing a closing }.
lol ty for headsup lol.

lol ok here is the next confusing part then. I closed battle() right above usepotion() (it is the only then that can close at that indentation aswell, but if i put a second } directly below it, the program runs. (can anyone explain this then?)
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 4,335
Reputation: Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future 
Solved Threads: 236
Team Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: declaration syntax error?

 
0
  #5
Feb 5th, 2005
This it pretty nasty looking code to debug; it looks like stuff I wrote when I was 10.
  1. if ( attackedxtimes != (2 || 5) )
You'd better take another look at your C or C++ reference.

And search for blocked. You have scope issues -- I advise renaming one of them: the parameter or the temporary.
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 84
Reputation: evilsilver is an unknown quantity at this point 
Solved Threads: 1
evilsilver's Avatar
evilsilver evilsilver is offline Offline
Junior Poster in Training

Re: declaration syntax error?

 
0
  #6
Feb 5th, 2005
Originally Posted by Dave Sinkula
This it pretty nasty looking code to debug; it looks like stuff I wrote when I was 10.
  1. if ( attackedxtimes != (2 || 5) )
You'd better take another look at your C or C++ reference.

And search for blocked. You have scope issues -- I advise renaming one of them: the parameter or the temporary.
yeah i changed that line (and found what i didn't close)
it is now
  1. if (attackedxtimes != 2 &&attackedxtimes != 5){
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 84
Reputation: evilsilver is an unknown quantity at this point 
Solved Threads: 1
evilsilver's Avatar
evilsilver evilsilver is offline Offline
Junior Poster in Training

Re: declaration syntax error?

 
0
  #7
Feb 5th, 2005
lol just a couple of things, first of all keep in mind that i started c++ about 2 weeks ago monday so i am an extreme noob lol. so i am writing a basic program for a role playing game lol.

second, what do you mean by either the temporary or the paramater for blocked. i am gonna use blocked later on, i need to know how many times they blocked (it is for a secret item later on if you successfully block a boss 3 times you get it) (i also moved blocked++; to where he successfully blocks not just if he tries.)
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 4,335
Reputation: Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future 
Solved Threads: 236
Team Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: declaration syntax error?

 
0
  #8
Feb 5th, 2005
Originally Posted by evilsilver
lol just a couple of things, first of all keep in mind that i started c++ about 2 weeks ago monday so i am an extreme noob lol. so i am writing a basic program for a role playing game lol.
No -- no offense meant. The "just started"-ness is all I implied.
Originally Posted by evilsilver
second, what do you mean by either the temporary or the paramater for blocked. i am gonna use blocked later on, i need to know how many times they blocked (it is for a secret item later on if you successfully block a boss 3 times you get it) (i also moved blocked++; to where he successfully blocks not just if he tries.)
I was just looking my compiler output:
Warning W8030 testpp.cpp 91: Temporary used for parameter 'blocked' in call to 'battle(int &,int &,int &,int &,int &,int &,int &,int &,int,int,int,int,int,int,char *,int &,int &,char *,int &,int &)' in function main(int,char * *)
Warning W8030 testpp.cpp 101: Temporary used for parameter 'blocked' in call to 'battle(int &,int &,int &,int &,int &,int &,int &,int &,int,int,int,int,int,int,char *,int &,int &,char *,int &,int &)' in function main(int,char * *)
Warning W8030 testpp.cpp 111: Temporary used for parameter 'blocked' in call to 'battle(int &,int &,int &,int &,int &,int &,int &,int &,int,int,int,int,int,int,char *,int &,int &,char *,int &,int &)' in function main(int,char * *)
Warning W8030 testpp.cpp 123: Temporary used for parameter 'blocked' in call to 'battle(int &,int &,int &,int &,int &,int &,int &,int &,int,int,int,int,int,int,char *,int &,int &,char *,int &,int &)' in function main(int,char * *)
Warning W8080 testpp.cpp 131: 'blocked' is declared but never used in function main(int,char * *)
Warning W8004 testpp.cpp 131: 'score' is assigned a value that is never used in function main(int,char * *)
Warning W8004 testpp.cpp 131: 'secretitems' is assigned a value that is never used in function main(int,char * *)
Warning W8004 testpp.cpp 71: 'goblinhp' is assigned a value that is never used in function main(int,char * *)
Warning W8004 testpp.cpp 22: 'def' is assigned a value that is never used in function main(int,char * *)
Warning W8030 testpp.cpp 151: Temporary used for parameter 'blocked' in call to 'battle(int &,int &,int &,int &,int &,int &,int &,int &,int,int,int,int,int,int,char *,int &,int &,char *,int &,int &)' in function battle(int &,int &,int &,int &,int &,int &,int &,int &,int,int,int,int,int,int,char *,int &,int &,char *,int &,int &)
Warning W8030 testpp.cpp 160: Temporary used for parameter 'blocked' in call to 'battle(int &,int &,int &,int &,int &,int &,int &,int &,int,int,int,int,int,int,char *,int &,int &,char *,int &,int &)' in function battle(int &,int &,int &,int &,int &,int &,int &,int &,int,int,int,int,int,int,char *,int &,int &,char *,int &,int &)
Warning W8030 testpp.cpp 168: Temporary used for parameter 'blocked' in call to 'battle(int &,int &,int &,int &,int &,int &,int &,int &,int,int,int,int,int,int,char *,int &,int &,char *,int &,int &)' in function battle(int &,int &,int &,int &,int &,int &,int &,int &,int,int,int,int,int,int,char *,int &,int &,char *,int &,int &)
Warning W8030 testpp.cpp 178: Temporary used for parameter 'blocked' in call to 'battle(int &,int &,int &,int &,int &,int &,int &,int &,int,int,int,int,int,int,char *,int &,int &,char *,int &,int &)' in function battle(int &,int &,int &,int &,int &,int &,int &,int &,int,int,int,int,int,int,char *,int &,int &,char *,int &,int &)
Warning W8030 testpp.cpp 190: Temporary used for parameter 'blocked' in call to 'battle(int &,int &,int &,int &,int &,int &,int &,int &,int,int,int,int,int,int,char *,int &,int &,char *,int &,int &)' in function battle(int &,int &,int &,int &,int &,int &,int &,int &,int,int,int,int,int,int,char *,int &,int &,char *,int &,int &)
Warning W8004 testpp.cpp 211: 'dammage' is assigned a value that is never used in function battle(int &,int &,int &,int &,int &,int &,int &,int &,int,int,int,int,int,int,char *,int &,int &,char *,int &,int &)
You are passing 0, but pass-by-reference expects a variable (I believe).

If you want pass-by-value, say so in the function declaration and definition.
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 84
Reputation: evilsilver is an unknown quantity at this point 
Solved Threads: 1
evilsilver's Avatar
evilsilver evilsilver is offline Offline
Junior Poster in Training

Re: declaration syntax error?

 
0
  #9
Feb 5th, 2005
lol i was wondering about those wanings i got too, but it ran without it, so i didn't think much of it. i can use the variable and set it equal to 0 first, that oughta work.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC