#include #include #include #include #include #include #include #include #include #include #define suond if(S){sound(440);delay(300);nosound();} #define suond0 if(S){sound(640);delay(200);nosound();} #define suond2 if(S){sound(50);delay(500);nosound();} //************************WORD***************************************** #define index rand()%9 #define Max 9 //****************************IM83************************************* typedef struct{ //this truct will contain the sentences frome the user and restor them char Question[30]; //Questions sentences frome the user char Answer[30]; //Answers sentences frome the user char R_Answer[30]; // rendom sentences will be used if ther were no answer were found }Talk; //Talk is the name of the struct int S=1;//,delnum=0,innum=0; //1 = suond on , 0 = suond off //********************************HOLLY********************************************* struct books{ int per; char *name; }holly[]={ {50,"š‰™€˜" }, {40,"š…Ž™" }, {26,"€˜—‰…" }, {36,"˜ƒŽ" }, {34,"‰˜ƒ" }, {24,"’…™…„‰" }, {21,"‰ˆ”…™" }, {31,"€ Œ€…Ž™" }, {24," Œ€…Ž™" }, {22,"€ ‰‹ŒŽ" }, {25," ‰‹ŒŽ"}, {66,"…„‰’™‰" }, {52,"…„‰Ž˜‰" }, {48,"Œ€—†‡‰" }, {12,"˜™’ ‰˜š" }, {66,"‰Œ‰„š" }, {31,"‰Œ™Ž" }, {42,"…‰€" }, {8,"‰˜‰™„ ˜‰™" }, {4,"š…˜" }, {4,"„‹‰€" }, {12,"šŒ„—" }, {9,"˜š‘€" }, {12,"Œ€‰ƒ" }, {10,"€˜†’" }, {13,"„‰Ž‡" }, {29,"€ ‰Ž‰„ ‰˜‰ƒ" }, {36," ‰Ž‰„ ‰˜‰ƒ" } }; //*************************************TARROT**************************************** struct vers { char *lettr; } numbers []={ {"?"}, {"€"}, {""}, {"‚"}, {"ƒ"}, {"„"}, {"…"}, {"†"}, {"‡"}, {"ˆ"}, {"‰"}, {"€‰"}, {"‰"}, {"‚‰"}, {"ƒ‰"}, {"…ˆ"}, {"†ˆ"}, {"†‰"}, {"‡‰"}, {"ˆ‰"}, {"‹"}, {"€‹"}, {"‹"}, {"‚‹"}, {"ƒ‹"}, {"„‹"}, {"…‹"}, {"†‹"}, {"‡‹"}, {"ˆ‹"}, {"Œ"}, {"€Œ"}, {"Œ"}, {"‚Œ"}, {"ƒŒ"}, {"„Œ"}, {"…Œ"}, {"†Œ"}, {"‡Œ"}, {"ˆŒ"}, {"Ž"}, {"€Ž"}, {"Ž"}, {"‚Ž"}, {"ƒŽ"}, {"„Ž"},{"…Ž"},{"†Ž"},{"‡Ž"},{"ˆŽ"},{""}, {"€"},{""},{"‚"},{"ƒ"},{"„"},{"…"},{"†"},{"‡"},{"ˆ"},{"‘"},{"€‘"},{"‘"}, {"‚"},{"ƒ‘"},{"„‘"},{"…‘"},{"†‘"} }; //********************************************************************************************** struct klaf { char *klafname; } card_names []={ {"„ˆ…™„"},{"…‰—„"},{"‰Ž‰”„ Œ…—„"},{"š…‰š–˜‰–‰"}, {"ƒ˜…Ž„"},{"š…‰Ž™‚-‰€"},{"‰„€„"},{"š…’ƒ…Ž"},{"•Ž…€"},{"š…ƒŒ"}, {"‰…‰™"},{"Š˜ƒ š–‰˜”"},{"™ƒ‡ …†‡"},{"š…š™„"},{"š…˜‡š„"},{"„‰š„"}, {"„˜’‘"},{"ˆ—™"},{"‰Ž…ƒ— ‰‰‡"},{"š…Ž‰Žš"},{"š…‰Œ™€Œ ˜’Ž"},{"…‰‘"}, {"˜ˆ‘€Ž„"},{"˜–…‰„"},{"„‰š"},{"„Ž–…’"},{"š……™"},{"‚‰Œ‰„"}, {"„ˆ‰Œ— š…™‰‚˜"},{"…Ž€"},{"„„"},{"„ˆ‰Œ™"},{"š…‰˜‘…Ž"},{"—€Ž"}, {"Œ‹™"},{"’”™"},{"„‡‰˜”"},{"„ˆ€„"},{"„—š”˜„"},{"š…‰…˜™”€"}, {"š…‘š„"},{"š…”šš™„"},{"š…ˆŒ‡Ž"},{"„‡Œ–„"},{"•‡Œ"},{"’‘Ž"}, {"š…™‰™š"},{"„—‡ƒ„"},{"˜…—Ž„"},{"š…‰š…˜‡"},{"„‚‰‚‡"},{"„Ž‰”"}, {"˜’Œ š…ƒŽ–‰„"},{"…Œ‡„"},{"š…‹Œ™„"},{"˜…˜‡™"},{"š…Œ–’"},{"„‰…Ž˜„"}, {"˜†„ ’"},{"š…‰™€ Œ…–‰”"},{"ƒ…ƒ‰"},{"„‰‰‡ƒ"},{"„€……™„"},{"Œˆ„"}, {"„—ˆ‰Œ…”"},{"„Ž™€"},{"˜’–"},{"™ƒ‡Ž „ƒ‰Œ"},{"„’ƒ…š"},{"’‚˜Œ ’‚˜Ž"}, {"„‹˜ƒ„"},{"–Ž—„"},{"‰…–‰‡„"},{"„˜™”"},{"š…Œ‘"},{"š…Œ‰‚˜"}, {"š…Œ™"},{"Œ…’„ …‡€"},{"š…˜‚"} }; //***************************************************************************** // WORD //***************************************************************** struct Sentencs { char *body; char *body2; char *verb; char *adverb; char *whqustion; char *times; char *names; }Sent[]={ //body, body2 ,verb ,adverb,whqustion,times,names; {"I am" ,"Am I","thinking","fast","why","tomorrow","in the CPU"}, {"you are","Are you","eating","slow","how","yesterday","in the RAM"}, {"she is","Is she","going","easy","when","next week","in the house"}, {"he is","is he","walking","","why","long time ago","in the CPU"}, {"we are","are we","running","slow","how","yesterday","in the RAM"}, {"they are","are they","swime","easy","when","nye","in the house"}, {"it is","is it","sleeping","fast","why","tomo","in the CPU"}, {"you are","Is she","haveing","slow","how","yester","in the RAM"}, {"she is","Are you","goinga","easy","when","next","in the house"}, {"I am","Am I","thin","fast","why","tomorro","in the CPU"}, {"you are","Is she","eatings","slow","how","yesterda","in the RAM"}, {"she is","Are you","goingb","easy","when","next wee","in the house"} }; //**************************HOLLY*************************************** void holly_book (); void cards(); void main_toto(); void loto(); void toto(); //*******************************WORD********************************** int main_words(char ch[]); int serch_word(char ch,int choise); void song_word(char ch,int num); int Anlize(char ch[]); //***************************************************************** //***************************************************************** int Menu() //this is the main menu which contain all the option { int choise; //choise is the varbel which the function returns { textcolor(WHITE); //use Break to stop function but not leave the progrem cprintf("\n —‘”„ 0-Break\r"); textcolor(BLUE); // use Insert to input sentences to the struct(Talk) cprintf("\n ‰ˆ”™Ž ‘‹„ 1-Insert sentences\r"); textcolor(RED);// use Clear to delete sentences from the struct(Talk) cprintf("\n ‰ˆ”™Ž —‡Ž 2-Clear sentences\r"); textcolor(GREEN); // use Talking with the computer cprintf("\n ˜…‰ƒ 3-Talking\r"); textcolor(YELLOW); // Display will show all the recorded Talk structs cprintf("\n ‚–„ 4-Display\r"); textcolor(CYAN); //will conect to distant progrems cprintf("\n ˆ…˜€ˆ,Šš 5-Holly book,tarrot\r"); textcolor(LIGHTGREEN); cprintf("\n …ˆ…Œ …ˆ…ˆ 6-TOTO LOTO\r"); textcolor(LIGHTMAGENTA); cprintf("\n „˜‰™ 7-Song\r"); textcolor( LIGHTGRAY); cprintf("\n Œ…— 8-Sound\r"); textcolor(MAGENTA); //to exit from the progrem cprintf("\n „€‰–‰ 9-Exit\n\r"); flushall(); textcolor(WHITE);//chang font color to white scanf("%d",&choise);suond0 return choise; //return to main } } //*******************************IM83********************************************** //***************************************************************** int menu2() { int number; //secondery menu for spesific choise cprintf(" 1-serch by Question"); cprintf(" 2-serch by Answer"); cprintf(" 3-close..\n\r"); flushall(); textcolor(WHITE); cprintf(" "); scanf("%d",&number); suond0 return number; //retrns to DO1 which choise were selected(in number) } //***************************************************************** //this function will print the hole Talk struct or part of it according to 'cas' void talk_list_print(Talk ptr,int cas) { switch(cas) { case 1:{ textcolor(YELLOW); //used in case of choise 4-display cprintf("Question :%s\n\r",ptr.Question); cprintf("Answer :%s\n\r",ptr.Answer); cprintf("Random answer :%s\n\r",ptr.R_Answer); textcolor(WHITE); break; } case 2:{ suond textcolor(GREEN); //used in case of choise 3-Talking cprintf(" ΙΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝ»\n\r"); cprintf(" Answer :%10s \n\r",ptr.Answer); cprintf(" ΘΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΌ\n\r"); textcolor(WHITE); break; } case 3:{ suond textcolor(YELLOW); //used in case of choise 3-Talking but in this case ther were no answer were found cprintf(" ΙΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝ»\n\r"); cprintf(" Answer :%s\n\r",ptr.R_Answer); cprintf(" ΘΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΌ\n\r"); textcolor(WHITE); break; } default:{ clrscr(); suond2 textcolor(RED); printf("Wrong choise\n");textcolor(WHITE); break; } } textcolor(WHITE); } //***************************************************************** //this function is serching question in Talk struct ,use in Tallking,Clear //resive *arr pointer to the struct ,num reprisent the last stractcher //ch[30] will resive the sentence frome the user to comper // with the ones that are allredy in the struct void serch_Question(Talk *arr,int num) { //use to serch for answer to same question char ch[30],n=0; int cm,i,j=0,choise3; clrscr(); textcolor(GREEN); cprintf("Ask Question :\n\r"); cprintf(" "); flushall(); //clear the buffer textcolor(WHITE); gets(ch); suond0 clrscr(); for(i=0;iQuestion); suond0 cprintf("\n\r Insert Answer : "); flushall(); gets(temp->Answer); suond0 cprintf("\n\r Insert random Answer :"); flushall(); gets(temp->R_Answer); suond0 (*num)++; //add 1 to num clrscr(); textcolor(WHITE); return temp; //to case 1 in main (1-Insert) } //***************************************************************** //big is putting the temp struct in the end of Talk struct int BiG(Talk ** arr,Talk *temp,int num,int *innum) { int i; Talk *ptr; ptr = (Talk *)malloc(sizeof(Talk)*(num)); if(!ptr) { textcolor(RED); suond2 suond2 cprintf(" Not anough memory\n\r"); textcolor(WHITE); getch(); clrscr(); return 0; } for(i=0;i0) { cprintf(" Question %s deleted :\n\r",ch);suond (*delnum)++; } else { textcolor(YELLOW); suond2 cprintf(" Did not found Question : %s\n\r",ch); } textcolor(WHITE); getch(); } //***************************************************************** void del_Answer(Talk **arr,int *num,int *delnum) { char ch[20]; int cm,i,j,g; Talk *temp=NULL; clrscr(); textcolor(RED); cprintf(" Insert Answer to delete : "); flushall(); gets(ch); cprintf("\n\r"); clrscr(); for(i=0,j=0;i<*num;i++) { cm=strcmp((*arr)[i].Answer,ch); if (cm==0) j++; } temp = (Talk *)malloc(sizeof(Talk)*((*num)-j)); for(i=0,g=0;i<*num;i++) { cm=strcmp((*arr)[i].Answer,ch); if (cm!=0) { temp[g]=(*arr)[i]; g++; } } free(*arr); *arr=temp; *num=(*num)-j; if(j>0) { cprintf(" Answer %s deleted :\n\r",ch); suond (*delnum)++; } else { textcolor(YELLOW); suond2 cprintf(" Did not found Answer : %s\n\r",ch); } textcolor(WHITE); getch(); } //***************************************************************** void DO1(Talk **arr,int *num,int *delnum) { int choise2; do { choise2= menu2(); switch(choise2) { case 1:{ del_Question(arr,num,delnum); choise2=3;break; } case 2: { del_Answer(arr,num,delnum); choise2=3;break; } default:{ if(choise2!=3) { clrscr(); textcolor(RED); suond2 cprintf(" Wrong choise\n\r"); textcolor(WHITE); break; } else clrscr(); } } }while(choise2!=3); textcolor(WHITE); } //***************************************************************** void open_file(Talk **arr,FILE *fr,int *num) { //fread reads a specified number of equal-sized data items int i; //from an input stream into a block. Talk *temp; fread(num,sizeof(int),1,fr); temp = (Talk *)malloc(sizeof(Talk)*(*num)); fread((temp),sizeof(Talk),*num,fr); *arr=temp; } //***************************************************************** void save_file(Talk **arr,FILE *fw,int num) { //fwrite appends a specified number of equal-sized data items //to an output file. int i,size; fwrite(&num,sizeof(int),1,fw); fwrite((*arr),sizeof(Talk),num,fw); } //***************************************************************** //this will write songs void Song(Talk *arr,int num) { int tmp,Size; char ch[30]; textcolor(LIGHTMAGENTA); tmp=rand()%num; cprintf(" %s \n\n\r",arr[tmp].Answer); Size=strlen(arr[tmp].Answer); strcpy(ch,arr[tmp].Answer); song_word(ch[Size-1],1); //#include "a:\words.h"" tmp=rand()%num; cprintf(" %s\n\r",arr[tmp].Question); Size=strlen(arr[tmp].Question); strcpy(ch,arr[tmp].Question); song_word(ch[Size-1],1); tmp=rand()%num; cprintf(" %s\n\r",arr[tmp].R_Answer); Size=strlen(arr[tmp].R_Answer); strcpy(ch,arr[tmp].R_Answer); song_word(ch[Size-1],2); textcolor(WHITE); getch(); } // HOLLY //***************************************************************************** void main_holly() { int choise,ok; do { textcolor(15); //WHITE cprintf(" to exit press 0 ™—„ „€‰–‰Œ\n\r"); textcolor(3); //CYAN cprintf("\n to Holly book press 1\n\rto Tarrot press 2\n\r"); flushall(); textcolor(15); cprintf(" "); scanf("%d",&choise); clrscr (); if(choise==1) holly_book(); if(choise==2) cards(); } while (choise!=0); textcolor(15); } //************************************************************************ void holly_book() { int i=0,p; char qwest[20]; clrscr(); randomize (); do { textcolor(3);//CYAN cprintf(" ask your qwestion and get an answer from the writen\n\r ‰…š‹ Šš…™š €–Žš… ŠšŒ€™ Œ€™\n\r"); textcolor(15); flushall(); cprintf(" "); gets(qwest); randomize (); i=rand()%28; textcolor(2); //GREEN cprintf(" „€‰˜—Œ •ŒŽ…Ž %s...Œ ’‚… ‡…€\n\r ",qwest); cprintf(" ΙΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝ»\n\r"); p=holly[i].per; cprintf(" Book %s ˜”‘",holly[i].name); i=rand()%p; cprintf(",Chapter %s —˜” ",numbers[i].lettr); i=rand()%25; cprintf(" ,Sentence %s —…‘”\n\r",numbers[i].lettr); cprintf(" ΘΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΌ\n\r"); textcolor(15); getch(); clrscr(); } while (getch()!='0'); } //*************************************************************************** void cards() { char name[20]; char qwest[30]; int a,b,c,d,e,s; char key; int ch,times,card,chois ; //_setcursortype(_NOCURSOR); //Ž‘ —‡…Ž clrscr (); textcolor (13); gotoxy(20,5); cprintf("Osho Zen Tarrot †„ Œ™ š…Œ’š„ —‡™Ž ˆ…˜€ˆ † …™…€"); delay (2000); clrscr (); textcolor (14); cprintf(" ,‰ƒŽ‰Ž ‰˜‰ƒ€ ‰‰‡ —˜ ’ƒ…‰ †„ \n\r"); cprintf(" .„—…Ž’ „‰…Ž˜„ š…˜‰š‘ ‰‰Ž Œ‹ ‰Œ‰‹Ž ˜™€ \n\r"); cprintf(" ,…‰„ ’ „‰…Ž˜„ „–Ž „Œ‰Œ„ \n\r"); cprintf(" ,š……Ž„ ’ „‰…Ž˜„ ‰€–Ž‰ ‰‰‡„… \n\r"); cprintf(" .‰Ž™„ ’ „‰…Ž˜„ š€–Ž „Žƒ€„… \n\r"); cprintf(" .˜ƒ’„ ’ „‰…Ž˜„ €–Ž ‡‹…„ \n\r"); cprintf(" ,š€†„ š…‰Ž†-…„ ,„˜‰ƒ€ „‰…Ž˜„„ \n\r"); cprintf(" .†„ Œ™ ‰˜—‰’„ ˜‘Ž„ €‰„ \n\r"); cprintf(" ,š„…€… šƒ‹Ž„ „ƒ‰‡‰„ ‰‰‡„ Š˜ƒ š€† \n\r"); cprintf(" .˜ƒ „‚Ž „‰€ ,„™‰‡‹Ž „‰€ ˜™€… \n\r"); getch(); do { randomize (); clrscr (); textcolor (3); a=rand()%78; b=rand()%78; c=rand()%78; d=rand()%78; e=rand()%78; randomize (); cprintf(" Think abut a qwestion or subject and write it here \n\r :€‹ …š…€ ƒŒ—„… ‰…‘Ž €™… …€ „Œ€™ Œ’ …™‡\n\r"); flushall(); textcolor(15); gets(qwest); clrscr(); textcolor(12);//LIGHTRED cprintf(" *************Choose one š…‰–”…€„ š‡€ ˜‡******************\n\r"); cprintf(" * ˜š…‰ †…”‡ ƒƒ… “Œ—Œ 1 *\n\r"); cprintf(" * ‘—…ƒ˜”„ ‰”Œ— „™…Œ™Œ 2 *\n\r"); cprintf(" * ‰‘‡‰ š‹˜’Ž :‰”Œ— „’˜€Œ 3 *\n\r"); cprintf(" * .‰…‘Ž €™… š…˜‰„ ˜š…‰Œ š˜†…’ „‡‰š”„ …Œ„‰„ 4 *\n\r"); cprintf(" ***********************************************************\n\r"); textcolor(15); //WHITE flushall(); cprintf(" "); scanf("%d",&chois); cprintf(" %s ...Œ ’‚… ‡…€\n\r",qwest); switch(chois) { case 1: { gotoxy (15,15); textcolor (4); randomize (); cprintf(" %15s...…‰ …š…€Œ ŠŒ™ „‰–ˆ‰ƒŽ‹ …€ –Ž Œ‹ Œ™ „…šŒ\n\r",card_names[a].klafname); break; } case 2 : { textcolor (5); cprintf(" %15s...…‰™‹’ \…€‹„ š€ ‚–‰Ž …™€˜„ “Œ—„ :‘—…ƒ˜”„\n\r",card_names[a].klafname); cprintf(" %15s ...ƒ…—„ Œ…‚Œ‰‚„ š’”™„ š€ ‚–‰Ž …˜‡€„ “Œ—„\n\r",card_names[b].klafname); cprintf(" %15s ....‘—…ƒ˜”„ Œ™ „…š„ š€ ‚–‰‰Ž “‘…„ “Œ—„\n\r",card_names[c].klafname); break; } case 3: { textcolor (6); randomize (); cprintf(" %15s : …‰™‹’/€‹ ‰‘‡‰„ š‹˜’ŽŒ ˜…š „š€™ „Ž… „š€\n\r",card_names[a].klafname); cprintf(" %15s : ‰‘‡‰„ š‹˜’ŽŒ ˜‡€„ šŽ…˜š ,˜‡€\n\r",card_names[b].klafname); cprintf(" %15s : š…‰‚˜€„ š…˜’š\n\r",card_names[c].klafname); cprintf(" %15s : „…š„\n\r",card_names[d].klafname); break; } case 4: { textcolor (9); randomize (); cprintf(" %15s : €™…„ 1\n\r",card_names[a].klafname); cprintf(" %15s: š…€˜Œ Œ…‹‰ Š‰€™ š…‰Ž‰” š…’”™„ 2\n\r",card_names[b].klafname); cprintf(" %15s : „Œ ’ƒ…Ž Š‰€™ š…‰…–‰‡ š…’”™„ 3\n\r",card_names[c].klafname); cprintf(" %15s : …˜š‰”Œ ™…˜ƒ „Ž 4\n\r",card_names[d].klafname); cprintf(" %15s : „„„ ,…˜š”„ 5\n\r",card_names[e].klafname); break; } default:{ clrscr(); textcolor(4);//RED printf(" Wrong choise\n"); break; } } } while (getch()!='0'); textcolor(15); } //*************************************************************************** // WORDS //*************************************************************************** int main_words(char ch[]) { int choise; choise=Anlize(ch); switch(choise) { case 0:{ randomize (); //make answer cprintf(" ΙΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝ»\n\r"); cprintf(" Answer : %s",Sent[index].body); randomize (); cprintf(" %s",Sent[index].names); randomize (); cprintf(" %s\n\r",Sent[index].times); randomize (); cprintf(" ΘΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΌ\n\r"); return 1;} case 1:{ randomize (); //make Question cprintf(" ΙΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝ»\n\r"); cprintf(" Question: %s ",Sent[index].whqustion);randomize (); cprintf(" %s",Sent[index].body2); randomize (); cprintf(" %s",Sent[index].adverb); randomize (); cprintf(" %s?\n\r",Sent[index].verb); randomize (); cprintf(" ΘΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΌ\n\r"); return 1; } default:{ return 0; } } } //***************************************************************** int Anlize(char ch[]) { char *ptr=0; int i ,flag=1; for(i=0;i