Coding
/*
This a c++ program that make the user feel like this program read their mind.
This program is a command prompt style and have a little animated text.
Build using Borland c++.
Original Programmer: Muhammad Amir Zaki Bin Zainal Alam
Mohamad Fikri Bin Ramlan
Upgrade By: Mohamad Fikri Bin Ramlan
*/
#include <iostream>//cout
#include <conio>//gotoxy, textcolor, cprintf, getch, clrscr
#include <stdio>//printf
//#include <time>//time_t and ...
#include <windows>//Sleep & SetConsoleTitle
char rdm()
{
return (rand() % 18) + 14;
};
char fix()
{
return (rand() % 18) + 14;
};
int main()
{
bool one=false;
int no, a, b, c;
_setcursortype(0);
//time_t t; time(&t)
srand((unsigned) time(0));
SetConsoleTitle( "MIND READER" );
system("mode con cols=74 lines=26"); //textmode(4); - tentukan size window
char output[512]= "\tChoose any two digit number, add both digits together\n\n"
"\tafter that, subtract the total from your original number\n\n"
"\tand then, look it up on the chart.\n\n"
"\tFind the relevant symbol. Concentrate on the symbol\n\n"
"\tand when you have it clearly in your mind press any key\n\n"
"\tand it will show you the symbol you're thinking of...\n\n\n\tExample:",
up[128]= "\n Choose any two-digit number, subtract the number with the total"
" after\n\n both digits added together. ";
x:
textcolor(LIGHTBLUE);
gotoxy(35,25);
cprintf("Author: Amir Zaki & Mohd Fikri");
gotoxy(1,1);
cout << "\t---------------------------------------------------------\n"
<< "\t MIND READER\n"
<< "\t---------------------------------------------------------\n\n";
if(one==false)
{
for(int a=0;a
{
cout << output[a];
Sleep(20); one=true;
if(kbhit())break;
}//gotoxy(1,1);printf("%02d",clock());-counter
Sleep(333);
}
else
cout<<output;
printf(" if you chose 23 \n\t\t\t");
textcolor(GREEN);
cprintf("Ans = 2 + 3 = 5");
cout<<"\n\t\t\t";
cprintf("Check the symbol besides 'Ans'.");
cout<<"\n\n\t\tPress any key to continue(esc - exit)...";
if(getch()==27)
return 0;
for(;;)
{
textcolor(3);
no=1; //ungetch(button ape yg nak mati);)
c=fix(); //cout<
clrscr(); //delline();
for(int a=0;a
{ cout << up[a]; Sleep(2); }
cprintf( "Focus on the symbol of the final number\n" );
for(b=0;b<9 ;b++)
{
cout << "\n\n ";
for(a=0;a<11;a++)
{
if (no<10)
{
if (no==9)
{
cprintf(" %d %c ",no,c);
no++;
}
else
{
cprintf(" %d %c ",no,rdm());
Sleep(1);
no++;
}
}
else
{
if ( no==81 || no==72 || no==63 || no==54 ||
no==45 || no==36 || no==27 || no==18 )
{
cprintf("%d %c ",no,c);
no++;
}
else
{
cprintf("%d %c ",no,rdm());
Sleep(1);
no++;
}
}
}
} Sleep(300);
cout << "\n\n Your symbol ";
for(;;){
gotoxy(15,25);
printf("[ ]");
Sleep(333);
gotoxy(15,25);
printf(" ");
Sleep(333);
if(kbhit())
{ int vv=getch();
if(vv==13)
{
textcolor(11);
gotoxy(15, 25);
cprintf("[ %c ]",c); Sleep(500);
break;
}
if(vv==27)
{ clrscr(); goto x;}
} }
cout<< "\tUnbelievable...? "; Sleep(1000);
for(;;){
gotoxy(25,25);
cout<<"PRESS any key to try again(esc for main menu)!";
Sleep(333);
gotoxy(25,25);
cout<<"\t\t\t\t\t\t";
Sleep(333);
if(kbhit())
{
if(getch()==27)
{ clrscr(); goto x;}
else
break;
}
}
}
}


No comments:
Post a Comment