- Dec 29, 2002
- 27,153
- 6
- 81
// This is weak, so feel free to steal it from me.
#include<iostream.h>
#include <cstdlib>
#include <time.h>
void roller (int* pH);
void main () {
int iAC;
int iThaco;
int iToHit;
char cYN;
int* pHit;
pHit = &iToHit;
cout<<"Input your character's modified THAC0:"<<endl;
cin>> iThaco;
cout<<"Now Input the monster's AC:"<<endl;
cin>> iAC;
iToHit = (iThaco - iAC);
cout<<"You Need a "<<iToHit<<" on a 1d20"<<endl<<endl;
cout<<"Do you wish to go onto the built in dice roller? y/n" <<endl;
cin >> cYN;
if ((cYN == 'y')||(cYN == 'Y'))
roller (pHit);
}
void roller (int* pH){
int iroll;
char cYN;
srand((unsigned)time(NULL));
do{
iroll = 1+ rand()%20 ;
if (iroll==20)
cout<< "Critical Hit! Roll Double Damage!"<<endl;
else if (iroll >= *pH)
cout<<"You HIT with a roll of " << iroll<<endl;
else if (iroll==1)
cout<<"Critical Miss! The DM will now punish you for sucking"<<endl;
else
cout<<"You MISS with a roll of "<<iroll<<endl;
cout<<"Do you wish to roll again? y/n"<<endl;
cin>> cYN;
}while ((cYN=='Y')||(cYN=='y'));
main();
}
does that make ANY sense? where are the errors?