C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old August 9th, 2005, 03:42 PM
Athildur Athildur is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2005
Posts: 1 Athildur User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 36 m 47 sec
Reputation Power: 0
Ü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.

Reply With Quote
  #2  
Old August 9th, 2005, 05:47 PM
B-Con's Avatar
B-Con B-Con is offline
:bcon: moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Location: int main()
Posts: 351 B-Con User rank is Private First Class (20 - 50 Reputation Level)B-Con User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Days 23 h 1 m 43 sec
Reputation Power: 4
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.



Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > Übern00b in distress!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway