View Full Version : Turbo C


ernestbien
13th Mar 2008 Thu, 11:24
mga bro, can u pls give me ideas nman po sa paggawa ng program using turbo c, witht he use of "fuctions, loops, if and else" need ko lang po...:help:

arjay
13th Mar 2008 Thu, 11:35
Mahirap tol pag TURBO C . .kc mas approchable na ang C++ at DEV C ngayon .. Pero the same lng naman yan sila.. but different in language nga lang. .:D

SAMPLE:You Should output the fortune cookies randomly make array declaration statement using if, else function and LOOP..

#include <stdio.h>
#include <stdlib.h>


char ans;
char fcookie;

void prn_random_fcookie(char y);

int fc_array[5];

fcookie = fc_array[5];
fcookie[0] = {Everything will now come your way.};
fcookie[1] = {Now is the time to try something new.};
fcookie[2] = {A handful of patience is worth more than a bushel of brains.};
fcookie[3] = {You have an active mind and a keen imagination.};
fcookie[4] = {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!");

}



void prn_random_fcookie (char y)
{

int i;

fc_array = rand();

for (i=0; i=y; i++)
{
gotoxy (19,8); textcolor(10);
cprintf ("Fortune cookie of the day:");

gotoxy (24,10); textcolor (11);
cprintf ("%s", fc_array);

fc_array = rand();
}

decision();
}




EDIT:Example lang yan using array statement..