: BORLAND C++ BUILDER

: BORLAND C++ BUILDER

̳

ֲ ò

________

___________________

:

BORLAND C++ BUILDER

____ __________ 2008.

____ __________ 2008.

_____________________

ϳ


˳


- C++ Builder Borland Windows 95 NT. C++ Builder , C++, . C++ Builder , C++, .

, (Borland C++ Builder). .


BORLAND C++ BUILDER

Borland C++ Builder - Borland , C++, Delphi. C++ Builder , .

C++ Builder

C++ Builder SDI-, , () (). , C++ Builder ' ' () (). ϳ .

cb200000.gif

.1. C++ Builder

C++ Builder. ' C++ Builder, . C++ Builder , . C++ Builder , , .

C++ Builder

() (). ³ ' , . , . ' . , (, , Windows 95 .)

cb200001.gif

. 2.

. ' , , .

C++ Builder : , 䳿 .

, ' 䳿, . ' , , ' .

cb200002.gif

.3. '

, . , (, ). (Properties). ' (published) . published-, (public), , . ' . '. .

, ', ( , , , ..).

䳿

(Events) ' , ( , , Windows 95 Windows NT 䳿, ' - 䳿). . C++ Builder , , ' 䳿 . 䳿, , .

, , , , ' 䳺, C++ Builder . , , . { ... }. , 䳿. , .

cb200003.gif

.4. .

, ' , '. , , : ->, :

Edit1->Show();

³, ' *.h ', ' ' (, ). , , ' .

, - . . , View/Project Manager. ' Project1.cpp.

cb200004.gif

.5.

. . , New Form . , Add , . - . , , ' , , , ' . , Remove .

Options , , , , , ( Delphi 2.0, C++ Builder ) .

cb200005.gif

. 6.

C++ Builder , .

, C++ Builder -- , - , , C++ Builder.

++ Builder

C++ Builder . , , . , File/New Application.

C++ Builder ' Project1.cpp, make- ' Project1.mak. , , , C++ Builder .

cb200006.gif

.7

. :

           .DFM,

           .CPP, C++.

           .H, .

, .

, File/New Form. ' , . File/New, Forms '.

cb200007.gif

.8

, , Compile Compile. , , , , Run Run. ( , ).

, C++ Builder , , . , , Run Run, . Windows.

:

, , , . File/New Application ' samp1.cpp, ' samp.mak. Button, EditListBox Standard .

cb200008.gif

. 9.

ϳ Edit Text. Caption Button1 "".

䳿 OnClick , , ' 䳿 OnClick. ' ' . C++ Builder . ϳ { ... } :

void __fastcall TForm1::Button1Click(TObject *Sender)

{

if (!(Edit1->Text == ""))

{

ListBox1->Items->Add(Edit1->Text);

Edit1->Text = "" ;

}

}

Run Run. - , , , , , .

cb200009.gif

.10. .

, . , Caption , ' :

cb200010.gif

. 11.

:

void __fastcall TForm1::Button2Click(TObject *Sender)

{

if (!(ListBox1->ItemIndex == -1))

ListBox1->Items->Delete(ListBox1->ItemIndex);

}

:

Close();

, .

, Borland C++ Builder .


. , 䳿 ( ). .

prg.txt [ ] ( 1).

˳ 1.

#include<stdio.h>

#include<conio.h>// Header Files

#include<graphics.h>

#include<string.h>

#include<time.h>

#include<stdlib.h>

// Inputs:void game()

void menu()

int question()

void contend()

void rules()

#include<stdio.h>

#include<conio.h>// Header Files

#include<graphics.h>

#include<string.h>

#include<time.h>

#include<stdlib.h>

#define n 10

#define NULL 0

int flag, take, choice;

char name[20][50];

void menu()

{

clrscr();

printf("\n\n WELCOME TO WHO'LL BE A MILLIONAIRE "

"\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "

"\n\n\t $$$$$$$$$$$$$$$$$$$$$ MAIN MENU $$$$$$$$$$$$$$$$$$$$ "

"\n$ $ "

"\n$ $ "

"\n\t $ Choice 1 : READ THE RULES OF THE GAME$ "

"\n$ $ "

"\n\t $ Choice 2 : ENTER THE NAME'S OF 10 CONTENDERS $ "

"\n$ $ "

"\n\t $ Choice 3 : PLAY GAME$ "

"\n$ $ "

"\n\t $ Choice 4 : EXIT$ "

"\n$ $ "

"\n\t $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ");

printf("\n\n\nPlease Enter Your Choice : ");

scanf(" %d", &choice);

}

float question()

{

time_t first, second;

char dummy[80];

float ret;

randomize(); // stdlib.h

raj :

{

if(random(20) == 0)// stdlib.h

{

first = time(NULL);

printf(" Who's Programmed [ WHO'LL BE A MILLIONAIRE ] :? ");

printf("\n\n A) HARRY \t\t B) GURJIT \n C) ALI \t\t D) MICHAEL ");

scanf(" %[^\n]", dummy);

second = time(NULL);

ret = difftime(second, first);

if((strcmpi(dummy, "b") == 0) || (strcmpi(dummy, "gurjit") == 0) )

{

printf(" RIGHT ANSWER ");

flag = 1;

}

else

{

printf(" WRONG ANSWER______The Answer Is ---> B / GURJIT SINGH ");

flag = 0;

}

}

else if(random(20) == 1)

{

first = time(NULL);

printf(" Which Is The Deepest Ocean :? ");

printf("\n\n A) PACIFIC \t\t B) ATLANTIC \n C) ARCTIC \t\t D) INDIAN ");

scanf(" %[^\n]", dummy);

second = time(NULL);

ret = difftime(second, first);

if( (strcmpi(dummy, "a") == 0) || (strcmpi(dummy, "pacific") == 0) )

{

printf(" RIGHT ANSWER ");

flag = 1;

}

else

{

printf(" WRONG ANSWER______The Answer Is ---> A / PACIFIC ");

flag = 0;

}

}

else if(random(20) == 2)

{

first = time(NULL);

printf(" How Many Continents Are There On This Planet [EARTH] :? ");

printf("\n\n A) 4 \t\t B) 5 \n C) 6 \t\t D) 7 ");

scanf(" %[^\n]", dummy);

second = time(NULL);

ret = difftime(second, first);

if( (strcmpi(dummy, "d") == 0) || (strcmpi(dummy, "7") == 0) )

{

printf(" RIGHT ANSWER ");

flag = 1;

}

else

{

printf(" WRONG ANSWER______The Answer Is ---> D / 7 ");

flag = 0;

}

}

else if(random(20) == 3)

{

first = time(NULL);

printf(" C/C++ Are Products Of Which American Company :? ");

printf("\n\n A) MICROSOFT \t\t B) IBM \n C) BORLAND \t\t D) NONE ");

scanf(" %[^\n]", dummy);

second = time(NULL);

ret = difftime(second, first);

if( (strcmpi(dummy, "c") == 0) || (strcmpi(dummy, "borland") == 0) )

{

printf(" RIGHT ANSWER ");

flag = 1;

}

else

{

printf(" WRONG ANSWER______The Answer Is ---> C / BORLAND ");

flag = 0;

}

}

else if(random(20) == 4)

{

first = time(NULL);

printf(" The Fastest Running Mammal On This Planet [EARTH] :? ");

printf("\n\n A) CHEETAH \t\t B) CAMEL \n C) MAN \t\t D) ELEPHANT ");

scanf(" %[^\n]", dummy);

second = time(NULL);

ret = difftime(second, first);

if( (strcmpi(dummy, "a") == 0) || (strcmpi(dummy, "cheetah") == 0) )

{

printf(" RIGHT ANSWER ");

flag = 1;

}

else

{

printf(" WRONG ANSWER______The Answer Is ---> A / CHEETAH ");

flag = 0;

}

}

else if(random(20) == 5)

{

first = time(NULL);

printf(" Which Of These Is An Output Device :? ");

printf("\n\n A) SCANNER \t\t B) PRINTER \n C) KEY BOARD \t\t D) MOUSE ");

scanf(" %[^\n]", dummy);

second = time(NULL);

ret = difftime(second, first);

if( (strcmpi(dummy, "b") == 0) || (strcmpi(dummy, "printer") == 0) )

{

printf(" RIGHT ANSWER ");

flag = 1;

}

else

{

printf(" WRONG ANSWER______The Answer Is ---> B / PRINTER ");

flag = 0;

}

}

else if(random(20) == 6)

{

first = time(NULL);

printf(" World's Longest River :? ");

printf("\n\n A) NILE \t\t B) SMILE \n C) MISSISSIPII \t D) GANGA ");

scanf(" %[^\n]", dummy);

second = time(NULL);

ret = difftime(second, first);

if( (strcmpi(dummy, "a") == 0) || (strcmpi(dummy, "nile") == 0) )

{

printf(" RIGHT ANSWER ");

flag = 1;

}

else

{

printf(" WRONG ANSWER______The Answer Is ---> A / NILE ");

flag = 0;

}

}

else if(random(20) == 7)

{

first = time(NULL);

printf(" The Highest Mountain Peak In The World :? ");

printf("\n\n A) K2 \t\t B) ROCKY \n C) NEGHY \t D) HIMALAYA ");

scanf(" %[^\n]", dummy);

second = time(NULL);

ret = difftime(second, first);

if( (strcmpi(dummy, "d") == 0) || (strcmpi(dummy, "himalaya") == 0) )

{

printf(" RIGHT ANSWER ");

flag = 1;

}

else

{

printf(" WRONG ANSWER______The Answer Is ---> D / HIMALAYA ");

flag = 0;

}

}

else if(random(20) == 8)

{

first = time(NULL);

printf(" My Favourite Movie :? ");

printf("\n\n A) TITANIC \t\t B) TERMINATOR - 2 \n C) MASK \t\t D) RAMBO ");

scanf(" %[^\n]", dummy);

second = time(NULL);

ret = difftime(second, first);

if( (strcmpi(dummy, "a") == 0) || (strcmpi(dummy, "titanic") == 0) )

{

printf(" RIGHT ANSWER ");

flag = 1;

}

else

{

printf(" WRONG ANSWER______The Answer Is ---> A / TITANIC ");

flag = 0;

}

}

else if(random(20) == 9)

{

first = time(NULL);

printf(" Rabies a Disease Is caused By :? ");

printf("\n\n A) LION \t\t B) TIGER \n C) DOG \t\t D) MONKEY ");

scanf(" %[^\n]", dummy);

second = time(NULL);

ret = difftime(second, first);

if( (strcmpi(dummy, "c") == 0) || (strcmpi(dummy, "dog") == 0) )

{

printf(" RIGHT ANSWER ");

flag = 1;

}

else

{

printf(" WRONG ANSWER______The Answer Is ---> C / DOG ");

flag = 0;

}

}

else if(random(20) == 10)

{

first = time(NULL);

printf(" Capital City Of India :? ");

printf("\n\n A) NEW DELHI \t\t B) NEW YORK \n C) SYDNEY \t\t D) LONDON ");

scanf(" %[^\n]", dummy);

second = time(NULL);

ret = difftime(second, first);

if( (strcmpi(dummy, "a") == 0) || (strcmpi(dummy, "new delhi") == 0) )

{

printf(" RIGHT ANSWER ");

flag = 1;

}

else

{

printf(" WRONG ANSWER______The Answer Is ---> A / NEW DELHI ");

flag = 0;

}

}

else if(random(20) == 11)

{

first = time(NULL);

printf(" How Many Wonders Are There In This World :? ");

printf("\n\n A) 6 \t\t B) 27 \n C) 8 \t\t D) 7 ");

scanf(" %[^\n]", dummy);

second = time(NULL);

ret = difftime(second, first);

if( (strcmpi(dummy, "d") == 0) || (strcmpi(dummy, "7") == 0) )

{

printf(" RIGHT ANSWER ");

flag = 1;

}

else

{

printf(" WRONG ANSWER______The Answer Is ---> D / 7 ");

flag = 0;

}

}

else if(random(20) == 12)

{

first = time(NULL);

printf(" Tan 45 Degree :? ");

printf("\n\n A) 1/2 \t\t B) 2 \n C) 1 \t\t\t D) 0 ");

scanf(" %[^\n]", dummy);

second = time(NULL);

ret = difftime(second, first);

if( (strcmpi(dummy, "c") == 0) || (strcmpi(dummy, "1") == 0) )

{

printf(" RIGHT ANSWER ");

flag = 1;

}

else

{

printf(" WRONG ANSWER______The Answer Is ---> C / 1 ");

flag = 0;

}

}

else if(random(20) == 13)

{

first = time(NULL);

printf(" Oracle 8i Is A :? ");

printf("\n\n A) LANGUAGE \t\t B) SUBJECT \n C) DATABASE \t\t D) NONE ");

scanf(" %[^\n]", dummy);

second = time(NULL);

ret = difftime(second, first);

if( (strcmpi(dummy, "c") == 0) || (strcmpi(dummy, "database") == 0) )

{

printf(" RIGHT ANSWER ");

flag = 1;

}

else

{

printf(" WRONG ANSWER______The Answer Is ---> C / DATABASE");

flag = 0;

}

}

else if(random(20) == 14)

{

first = time(NULL);

printf(" C++ Was Developed By :? ");

printf("\n\n A) BJARNE STROUSTRUP \t\t B) GURJIT \n C) DENNIS RITCHIE \t\t D) KERNINGHAM ");

scanf(" %[^\n]", dummy);

second = time(NULL);

ret = difftime(second, first);

if( (strcmpi(dummy, "a") == 0) || (strcmpi(dummy, "bjarne stroustrup") == 0) )

{

printf(" RIGHT ANSWER ");

flag = 1;

}

else

{

printf(" WRONG ANSWER______The Answer Is ---> A / BJARNE STROUSTRUP ");

flag = 0;

}

}

else if(random(20) == 15)

{

first = time(NULL);

printf(" Which Lizard Can Change Colors :? ");

printf("\n\n A) WALL \t\t B) MONSTER \n C) CHAMELEON \t\t D) NONE ");

scanf(" %[^\n]", dummy);

second = time(NULL);

ret = difftime(second, first);

if( (strcmpi(dummy, "c") == 0) || (strcmpi(dummy, "chameleon") == 0) )

{

printf(" RIGHT ANSWER ");

flag = 1;

}

else

{

printf(" WRONG ANSWER______The Answer Is ---> C / CHAMELEON ");

flag = 0;

}

}

else if(random(20) == 16)

{

first = time(NULL);

printf(" Mowgli Is a Character Of The Popular Comic :? ");

printf("\n\n A) CASPER \t\t B) JUNGLE BOOK \n C) ANASTITIA \t\t D) ALLADIN ");

scanf(" %[^\n]", dummy);

second = time(NULL);

ret = difftime(second, first);

if( (strcmpi(dummy, "b") == 0) || (strcmpi(dummy, "jungle book") == 0) )

{

printf(" RIGHT ANSWER ");

flag = 1;

}

else

{

printf(" WRONG ANSWER______The Answer Is ---> B / JUNGLE BOOK ");

flag = 0;

}

}

else if(random(20) == 17)

{

first = time(NULL);

printf(" Author Of The Jungle Book :? ");

printf("\n\n A) G B SHAW \t\t\t\t B) PREM CHAND \n C) WILLIAM SHAKESPEARE \t\t D) RUDYARD CIPLING ");

scanf(" %[^\n]", dummy);

second = time(NULL);

ret = difftime(second, first);

if( (strcmpi(dummy, "d") == 0) || (strcmpi(dummy, "rudyard cipling") == 0) )

{

printf(" RIGHT ANSWER ");

flag = 1;

}

else

{

printf(" WRONG ANSWER______The Answer Is ---> D / RUDYARD CIPLING ");

flag = 0;

}

}

else if(random(20) == 18)

{

first = time(NULL);

printf(" India Is a :? ");

printf("\n\n A) PENNINSULA \t\t B) ISLAND \n C) PLATEAU \t\t D) NONE ");

scanf(" %[^\n]", dummy);

second = time(NULL);

ret = difftime(second, first);

if( (strcmpi(dummy, "a") == 0) || (strcmpi(dummy, "penninsula") == 0) )

{

printf(" RIGHT ANSWER ");

flag = 1;

}

else

{

printf(" WRONG ANSWER______The Answer Is ---> A / PENNINSULA ");

flag = 0;

}

}

else if(random(20) == 19)

{

first = time(NULL);

printf(" Earth's Only Natural Satellite :? ");

printf("\n\n A) SUN \t\t B) PLUTO \n C) JUPITER \t\t D) MOON ");

scanf(" %[^\n]", dummy);

second = time(NULL);

ret = difftime(second, first);

if( (strcmpi(dummy, "d") == 0) || (strcmpi(dummy, "moon") == 0) )

{

printf(" RIGHT ANSWER ");

flag = 1;

}

else

{

printf(" WRONG ANSWER______The Answer Is ---> D / MOON ");

flag = 0;

}

} else

{

goto raj;

}

}

return(ret);

}

void rules()

{

clrscr();

printf("Hello And Welcome To WHO'LL BE A MILLIONAIRE ");

printf(" \n\n");

printf(" This Game Will Be Played Using 10 Contenders One Out Of 10,");

printf(" Will \n Be Selected In The First Round : FASTEST CONTENDER FIRST \n\n");

printf(" He/She Will Then be Asked 15 Questions And Shall Win Money[$] As : \n");

printf("\n Question No. 1 -> $1000 "

"\n Question No. 2 -> $2000 "

"\n Question No. 3 -> $3000 "

"\n Question No. 4 -> $4000 "

"\n Question No. 5 -> $5000[ 1st HURDLE ] "

"\n Question No. 6 -> $10,000 "

"\n Question No. 7 -> $20,000 "

"\n Question No. 8 -> $40,000 "

"\n Question No. 9 -> $80,000 "

"\n Question No.10 -> $1,60,000 "

"\n Question No.11 -> $3,20,000 [ 2nd HURDLE ] "

"\n Question No.12 -> $9,60,000 "

"\n Question No.13 -> $28,80,000 "

"\n Question No.14 -> $86,40,000 "

"\n Question No.15 -> $25,920,000 [ You Are a Millionaire ]");

printf("\n\n\n To CONTINUE READING The Rules Of This Game Please Press ENTER.....");

getch();

printf(" \n\n (** If You Fail To Cross The [1st HURDLE] You Take Home $ 0 **)");

printf(" \n (** Cross [1st HURDLE] = You Win atleast $10,000 **) \n (** Cross [2nd HURDLE] = You Win Atleast $4,80,000 **) ");

getch();

}

void contend()

{

int j;

clrscr();

printf(" \n\n Please Enter The 10 Contenders : \n\n");

for(j = 0; j < n; j++)

{

printf("\n CONTENDER %2d: ", j+1);

scanf(" %[^\n]", &name[j]);

}

}

void game()

{

int que, i, val=0;

long sum = 0;

float ret=0, temp = 100;

clrscr();

for(i = 0; i < n; i++)

{

printf("\n\n %d. %s --- ", i+1, name[i]);

ret = question();

if(flag == 1)

{

printf("\n\n %s You took %f seconds", name[i], ret);

take = flag;

if(ret < temp)

{

temp = ret;

val = i;

}

}

}

if(take == 0)

{

printf("\n\n \a NOBODY QUALIFIES FOR THE FINAL ");

getch();

}

else if(take == 1)

{

printf(" \n\n Congratulations %s You Shall Play Because You Took %f seconds ", name[val], temp);

printf(" \n\n\n %s , Let's PLAY WHO'LL BE A MILLIONAIRE ........PLEASE PRESS ANY KEY ", name[val] );

getch();

for(i = 0; i < 15; i++)

{

printf("\n\n Here's Your %d Question %s --> ", i+1, name[val]);

printf("\n");

question();

if(flag == 1 && i <= 4)

{

printf("\n\n %s You WIN $ %ld ", name[val], sum += 1000);

}

else if(flag == 0 && i <= 4)

{

printf("\n\n\a %s SORRY You WIN $ 0", name[val]);

getch();

goto close;

}

if(i == 4)

{

textcolor(LIGHTMAGENTA);

printf("\n\n");

cprintf(" Congratulations %s -- $$ Crossing The 1st HURDLE -- YOU WIN $5000 ", name[val]);

}

if( (flag == 1) && (i > 4 && i <= 10) )

{

printf("\n\n %s You WIN $ %ld ", name[val], sum *= 2);

}

else if( (flag == 0) && (i > 4 && i <= 10) )

{

printf("\n\n\a %s SORRY You WIN $ 10,000", name[val]);

getch();

goto close;

}

if(i == 10)

{

textcolor(LIGHTGREEN);

printf("\n\n");

cprintf(" Congratulations %s -- $$ Crossing The 2nd HURDLE -- YOU WIN $3,20,000 ", name[val]);

}

if( (flag == 1) && (i > 10 && i <= 14) )

{

printf("\n\n %s You WIN $ %ld ", name[val], sum *= 3);

}

else if( (flag == 0) && (i > 10 && i <= 14) )

{

printf("\n\n\a %s SORRY You WIN $ 3,20,000", name[val]);

getch();

goto close;

}

if(i == 14)

{

for(int k = 0; k < 1000; k++)

{

textbackground(LIGHTRED);

textcolor(LIGHTGREEN);

cprintf("_ MILLIONAIRE _");

}

}

getch();

} // END OF for

}// END OF else

close:

}// END OF game()

main()

{

clrscr();

while(choice != 4)

{

choice = 0;

textcolor(LIGHTCYAN);

menu();

switch(choice)

{

case 1 : textcolor(LIGHTGREEN);

rules();

break;

case 2 : textcolor(LIGHTMAGENTA);

contend();

break;

case 3: textcolor(LIGHTCYAN);

game();

break;

case 4 : break;

default : printf("\n\aSorry Wrong Choice Entered , ENTER ->> [1/2/3/4] ");

getch();

getch();

}

}

return(0);

}


1.

2.

3. ( )

, . () .

.


˳

[1] .., .. . ., 1992. 240 .

[2] . Borland C++. ., 1996. 400 .

[3] Borland C++ 4.0. ., 1994. 256 .

[4] ObjectWindows C++. ., 1993., 208 .



2010