void main() { clrscr(); color(); gotoxy(35,12); cprintf("FLAMES"); cout<<endl; cout<<"\t\t\t--*--*--*--*--*--*--*--*--"; _setcursortype(_NOCURSOR); int g=getch(); if (g==27) reet(); textcolor(7); loop: clrscr(); _setcursortype(_NOCURSOR); for (int r=1; r<4; r++) { textcolor(7); clrscr(); textcolor(12); gotoxy(35,12); cprintf("LOADING"); delay(520); cprintf("."); delay(520); cprintf("."); delay(520); cprintf("."); delay(520); } textcolor(7); clrscr(); _setcursortype(_NORMALCURSOR); int c,d,e; char a[25],b[25]; int p=color(); textcolor(p); gotoxy(36,2); cprintf("FLAMES"); cout<<endl; cout<<"\t\t\t ~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; textcolor(10); cprintf("F"); cout<<"riends "; textcolor(4); cprintf("L"); cout<<"over "; textcolor(14); cprintf("A"); cout<<"ffection "; textcolor(12); cprintf("M"); cout<<"arriage "; textcolor(6); cprintf("E"); cout<<"nemy "; textcolor(9); cprintf("S"); cout<<"weethearts "; cout<<endl; cout<<"Your name = "; gets(a); cout<<"Your Crush= "; gets(b); flamesalgo(a,b); cout<<"\nDo you want to test again (Y/N) : "; char flag=getch(); if (flag=='y'||flag=='Y') { textcolor(7); goto loop; } else { textcolor(7); clrscr(); textcolor(7); gotoxy(1,25); _setcursortype(_NOCURSOR); cout<<"\n\n\nThanks for playing the game!!!\t\t\t\t\tCREATED BY "; int o=color(); textcolor(o); cprintf("REET"); } getch(); }
int main() { //char buf[80]; ifstream fin("cis.log"); int ln= 1, gotit= 0; Assoc<int> tot("", 0); Regexp reet("(..):(..):(..)"), remnth("^(..)/../.."); Regexp r1("^(../../..) (..:..).. (.*)"); PerlString s; fin >> s; // eat first line while(fin >> s){ ln++; // cout << "line " << ln << ": <" << s << ">" << endl; PerlStringList l; //05/20/92 10:48PM CIS 2400 988-5366 //05/21/92 09:24PM OFFLINE 00:00:06 if(s.m(r1, l)){ if(l.scalar() < 4){ cerr << "Didn't match all expressions" << endl; exit(1); } // cout << "Expressions matched: " << endl << l << endl; PerlString a= l[3]; if(a.m("^CIS")) gotit= 1; else if(a.m("^OFFLINE") && gotit){ // extract Elapsed time PerlStringList et, mnth; int hr, mn, sc, tm; if(a.m(reet, et) != 4){ cerr << "Failed to extract Elapsed time" << endl; exit(1); } hr= atoi(et[1]); mn= atoi(et[2]); sc= atoi(et[3]); tm= (hr*60) + mn + ((sc >= 30) ? 1 : 0); gotit= 0; // extract month if(l[1].m(remnth, mnth) != 2){ cerr << "Failed to extract Month" << endl; exit(1); } // cout << "Month: " << mnth[1] << " Elapsed Time = " << tm << " mins" << endl; tot(mnth[1]) += tm; }else gotit= 0; }else{ cerr << "Didn't match any expressions" << endl; exit(1); } }; // cout << "tot = " << endl << tot << endl; Assoc<PerlString> months; months("01")= "January"; months("02")= "February"; months("03")= "March"; months("04")= "April"; months("05")= "May"; months("06")= "June"; months("07")= "July"; months("08")= "August"; months("09")= "September"; months("10")= "October"; months("11")= "November"; months("12")= "December"; for(int i=0;i<tot.scalar();i++) cout << months(tot[i].key()) << ": " << tot[i].value() << " mins $" << tot[i].value() * (12.50/60.0) << endl; exit(0); }
void main() { clrscr(); color(); gotoxy(35,12); cprintf("GUESSING GAME"); cout<<endl; cout<<"\t\t\t--*--*--*--*--*--*--*--*--*--*--"; _setcursortype(_NOCURSOR); int g=getch(); if (g==27) reet(); textcolor(7); loop: clrscr(); _setcursortype(_NOCURSOR); for (int r=1; r<4; r++) { textcolor(7); clrscr(); textcolor(12); gotoxy(35,12); cprintf("LOADING"); delay(520); cprintf("."); delay(520); cprintf("."); delay(520); cprintf("."); delay(520); } textcolor(7); clrscr(); _setcursortype(_NORMALCURSOR); char flag; int max=50,min=1,a; unsigned t=time(NULL); srand(t); int range=max-min+1; int h=rand()/100%range+min; color(); cout<<"\t\t\t\t"; cprintf("GUESSING GAME"); cout<<"\n\t\t\t~~~~~~~~~~~~~~~~~~~~~~~~~~~"; cout<<"\nThere is a hidden no. you have 5 turns to guess that no.\nHINT:-The no. is between 1-50"; for (int i=1; i<=5; i++) { cout<<"\n\nguess the no."; cin>>a; if (a==h) { cout<<"\n\nyour guess is correct.. you "; color(); cprintf("WIN !!!"); goto loop1; } if (a<h) { cout<<"\nyour guess is lesser than the hidden no. "; } if (a>h) { cout<<"\nyour guess is bigger than the hidden no. "; } if (i!=5) { cout<<"\n\ntry again"; } } cout<<"\n\nOops you have used all your turns ...\n\t\t\t\t"; color(); cprintf("YOU ARE A LOSER"); cout<<"\nthe hidden no. is "<<h; loop1: cout<<"\n\nDo you want to play again (Y/N) :"; flag=getch(); if (flag=='Y'||flag=='y') { textcolor(7); goto loop; } else { textcolor(7); clrscr(); gotoxy(1,25); _setcursortype(_NOCURSOR); textcolor(7); cout<<"\n\n\nThanks for playing the game!!!"; cout<<"\t\t\t\t\tCREATED BY "; color(); cprintf("REET"); } getch(); }