So, I'm not sure how to start, so I'll start with some code:
int main()
{
system("cls");
printf( "1. D4\n" );
printf( "2. D6\n" );
printf( "3. D8\n" );
printf( "4. Exit\n" );
printf( "Selection: " );
scanf( "%d", &input );
switch ( input ) {
case 1:
roll_d4();
break;
First off, I have this, and when I pick a selection, it works to get me to the function I wanted. So when I get to the D4 function, I have this:
void roll_d4() {
system("cls");
printf("How many D4 do you want to roll?\n");
printf("Enter a number 1-20");
printf("\nSelection: ");
scanf("%d", &input);
switch (input){
case 5:
exit(0);
d4_number();
}
Now, every time I try to run this, it doesn't like the d4_number(); and says it's an implicit declaration. I'm just trying to let you pick a selection and have it go to the next part in the code, in this case a function that will actually roll a die rather than being a menu like this one. But doing it this way isn't working, and I'm at a loss at what to do.
Edit: Code addition. Here's the full program:
#include <stdio.h>
#include <ctype.h>
#include <time.h>
#include <stdlib.h>
#include <stdbool.h>
#include<string.h>
#include<process.h>
#include<conio.h>
#include<ctype.h>
char response;
int sum = 0;
time_t t;
int result;
int die_d4_1 = 0;
int die_d4_2 = 0;
int die_d4_3 = 0;
int die_d4_4 = 0;
int die_d4_5 = 0;
int input;
void roll_d4() {
system("cls");
printf("How many D4 do you want to roll?\n");
printf("Enter a number 1-20");
printf("\nSelection: ");
scanf("%d", &input);
switch (input){
case 5:
exit(0);
d4_number(0);
}
}
void roll_d6()
{
printf( "How many D6 do you want to roll?" );
}
void roll_d8()
{
printf( "How many D8 do you want to roll?" );
}
void d4_number(){
printf("How many d4 do you want to roll?");
}
int main()
{
system("cls");
printf( "1. D4\n" );
printf( "2. D6\n" );
printf( "3. D8\n" );
printf( "4. Exit\n" );
printf( "Selection: " );
scanf( "%d", &input );
switch ( input ) {
case 1: /* Note the colon, not a semicolon */
roll_d4();
break;
case 2:
roll_d6();
break;
case 3:
roll_d8();
break;
case 4:
printf( "Thanks for playing!\n" );
break;
default:
printf( "Bad input, quitting!\n" );
break;
}
getchar();
}
It's obviously very incomplete, but I'm just trying to solve this problem before adding more.
d4_number()function. (If you have, then you haven't shown us all your code.)