| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Übern00b in distress!
Right, well, I will porbably be the person with the highest n00b-iness in here...I have this minor error that keeps popping up when I want to compile my only too simple program...Please help me (though it will probably be the most stupid question in the history of mankind
).the text I used: void main() int HP(int HD, int HDT, int RandomNum, int HDNums) { cout << "Enter the amount of hit dice you have:"; cin >> HD; cout << "Enter the highest number on your Hit Die type (a d8 would have 8 as the highest number):"; cin >> HDT; for(HDNums=1; HDNums > HD+1; HDNums++) { RandomNum = RANDOM_LONG(1, HDT); cout << "Level " << HDNums << " roll:" << RandomNum <<".\n"; HP+=RandomNum; } HP+=HDT; return HP; } the errors: 3 expected init-declarator before "int" 3 expected `,' or `;' before "int" Also, I'm not sure about...well, almost everything...I used to know how to work something as simple as this half a year ago...I'm such a git... Anyway, the RANDOM_LONG was pointed out to me by someone. I have no idea whether it works (it's supposed to generate a random number between 1 and the HDT variable.) the program's supposed to ask you for your HD(a number) and your HDT(also a number), then calculate the user's HP by the following method: For every level except 1, add a random number between 1 and HDT (like a dice roll) and add it to the HP variable. Then, it will add HDT to the HP variable. It's supposed to show every random number it generates for every "level" (HD) of the user, and, of course, show the total score, which is every number added together. If you have any suggestions (aka this program is totally screwed and I could've done it a lot easier), please let me know...I feel so stupid right now .thanks for the help! Last edited by Athildur : August 9th, 2005 at 03:47 PM. Reason: Forgot to put in /n to end the line after the outputs in the 'for' loop. |
|
#2
|
||||
|
||||
|
Code:
void main() What's that? You're going to need more than just that, add the entire main() function (with opening and closing braces) and recompile....
__________________
Officially a member of the Itsacon fan club. Beer blasts are every friday at Viper_SB's house. I bring the chips. ![]() |
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > Übern00b in distress! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|