Hi! anyone who could help me fix this code for it to work? i need your help very badly. :)
i'm having a hard time debugging my program for it to work... i dont know how to use the function rand() properly.. :rolleyes: tried everything i can but it just won't work.. please help me out. thanks. :)
the problem is in prn_random_fcookie (void)
#include <stdio.h>
#include <stdlib.h>
char ans;
void prn_random_fcookie(char y);
char fc_array[5][100] =
{
{"Everything will now come your way."},
{"Now is the time to try something new."},
{"A handful of patience is worth more than a bushel of brains."},
{"You have an active mind and a keen imagination."},
{"Don't let doubt and suspicion bar your progress."}
};
main()
{
gotoxy (19,8); textcolor(10);
cprintf ("Fortune cookie of the day:");
gotoxy (24,10); textcolor (11);
cprintf ("Everything will now come your way!");
decision();
getch();
clrscr();
}
decision(void)
{
gotoxy(31,21); textcolor(13);
cprintf ("want more [Y/N]? "); scanf ("%s", &ans);
if (ans == 'y' && 'Y')
{
prn_random_fcookie();
}
else
clrscr();
gotoxy (24,10); printf ("Goodbye! Have a nice day!");
}
prn_random_fcookie ()
{
srand (time(NULL));
char fc_array = rand();
for (char fc_array=0; fc_array<5; fc_array++)
{
gotoxy (19,8); textcolor(10);
cprintf ("Fortune cookie of the day:");
gotoxy (24,10); textcolor (11);
cprintf ("%s", fc_array);
char fc_array = rand();
}
decision();
}