на тему рефераты Информационно-образоательный портал
Рефераты, курсовые, дипломы, научные работы,
на тему рефераты
на тему рефераты
МЕНЮ|
на тему рефераты
поиск
Інтерактивна система навчання для вивчення англійської мови
ісля цього виберемо на формі компонентів 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. Тепер можна що-небудь увести в редагує поле, що, нажати мишею на кнопку Додати та переконатися, що вводять строки, що, додаються до списку.

Тепер модифікуємо додаток, додавши кнопки Видалити та Вихід. Для цього додамо ще дві кнопки, змінимо їхню властивість Caption і створимо оброблювачі подій, пов'язаних з натисканням на ці кнопки:

Для кнопки Видалити:

void __fastcall TForm1::Button2Click(TObject *Sender)

{

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

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

}

Для кнопки Вихід:

Close();

Збережемо та скомпілюємо додаток, а потім протестуємо його.

Отже, ми познайомилися із середовищем розробки Borland C++ Builder і створили простий додаток.

Практична частина

Так як середою розробки був вибраний інструментарій C++ Builder, то зрозуміло, що програма буде мати ряд особливостей, серед, яких слід відзначити наступні: програма являє собою єдиний модуль, для спрощення розробки був використаний лише текстовий інтерфейс, та розроблена програма має значний об`єм.

У зв`язку з останнім наведемо лише фрагмент коду головного модуля. (загальний лістинг розробленої програми знаходиться на дискеті разом з роботою)

Лістинг. (angl.cpp)

#include <iostream.h>

#include <dos.h>

#include <conio.h>

#include <string.h>

const char numberOfAnswer[] = "\nPress 5 for 50/50, 6 phone friend, 7 walk away.\n\n";

const char numberOfAnswer2[] = "Please enter the number of your choice: ";

const char people1[] = "John";

const char people2[] = "Mary";

const char people3[] = "Paul";

const char people4[] = "Kathy";

const char people5[] = "Greg";

const char people6[] = "Tracy";

const char people7[] = "Peter";

const char people8[] = "Lara";

const char people9[] = "Jason";

const char people0[] = "April";

const char people01[] = "Jeremy";

const char people02[] = "Paula";

const char people03[] = "Chris";

const char people04[] = "Jennifer";

const char people05[] = "Steve";

const char goodAnswer1[] = "\n\nCorrect!\n\n";

const char goodAnswer2[] = "\n\nGreat Job!!\n\n";

const char goodAnswer3[] = "\n\nKeep up the good work!\n\n";

const char goodAnswer4[] = "\n\nThat's right!!\n\n";

const char goodAnswer5[] = "\n\nWonderful answer!!!\n\n";

const char goodAnswer6[] = "\n\nRight!\n\n";

const char goodAnswer7[] = "\n\nYou must have studied. That's the right answer!\n\n";

const char goodAnswer8[] = "\n\nVery good!!!\n\n";

const char goodAnswer9[] = "\n\nYou're absolutely, positively correct!\n\n";

const char goodAnswer0[] = "\n\nWow!!\n\n";

const char goodAnswer01[] = "\n\nExcellent!\n\n";

const char goodAnswer02[] = "\n\nFabulous!\n\n";

const char goodAnswer03[] = "\n\nRight on!\n\n";

const char goodAnswer04[] = "\n\nYou're a genius!\n\n";

const char goodAnswer05[] = "\n\nSplendid!\n\n";

const char badAnswer1[] = "\n\nI'm sorry, that's the wrong answer. :( \n\n";

const char badAnswer2[] = "\n\nNope! That's not it!!!\n\n";

const char badAnswer3[] = "\n\nHahaha. You call that an answer?\n\n";

const char badAnswer4[] = "\n\nWrong.\n\n";

const char badAnswer5[] = "\n\nI'm ashamed of you picking that wrong answer!\n\n";

const char badAnswer6[] = "\n\nCome on! I know you're smarter than that! :( \n\n";

const char badAnswer7[] = "\n\nMaybe you should quit.\n\n";

const char badAnswer8[] = "\n\nWell the good news is there's another question ahead!\n\n";

const char badAnswer9[] = "\n\nI hope you make a better choice next time!\n\n";

const char badAnswer0[] = "\n\nI don't think so.\n\n";

const char badAnswer01[] = "\n\nThat ain't it.\n\n";

const char badAnswer02[] = "\n\nAnother wrong answer.\n\n";

const char badAnswer03[] = "\n\nDon't do this to me! Wrong answer. :( \n\n";

const char badAnswer04[] = "\n\nYou scare me. Wrong!\n\n";

const char badAnswer05[] = "\n\nNo no no! Not that one.\n\n";

const char question1[] = "What color is a dollar bill?\n";

const char question2[] = "If you have 3 quarters, you have...\n";

const char question3[] = "George Washington cut down what kind of tree?\n";

const char question4[] = "If A = B and B = C, then...\n";

const char question5[] = "Complete the phrase: Into the valley rode the...\n";

const char question6[] = "Who always saved Timmy?\n";

const char question7[] = "Who's first gold record was Hard Headed Woman?\n";

const char question8[] = "Who was author of Tom Sawyer and Huckleberry Finn?\n";

const char question9[] = "What was Shirley Temple's real life last name?\n";

const char question0[] = "Who plays the Priest in Anne of Green Gables?\n";

const char question01[] = "If a Sirloin Steak is cooked rare, it is generally what color in the middle?\n";

const char question02[] = "If Coca Cola is applied to an egg shell, the shell turns what color?\n";

const char question03[] = "What is the sum of 30 times 30 plus 90 plus 25?\n";

const char question04[] = "Who is the voice of Bart Simpson?\n";

const char question05[] = "Who was the original Clarke Kent?\n";

int yourAnswer;

int yourAnswer1;

char yourName[128];

int counter = 0;

int counter2 = 0;

int correctAnswers = 0;

unsigned long int score;

int walkAway();

void continueProgram();

int playMillionaire();

int fiftyFiftyUsed;

int phoneFriendUsed;

void answer1();

void answer2();

void answer3();

void answer4();

void answer5();

void answer6();

void answer7();

void answer8();

void answer9();

void answer0();

void answer01();

void answer02();

void answer03();

void answer04();

void answer05();

// Beginning of 50/50 functions

void answer1()

{

clrscr(); // Clears the screen

cout << question1; // Prints question1, defined above, to the screen

cout << " 2. Purple\n";

cout << "3. Green \n";

cout << numberOfAnswer2;

cin >> yourAnswer;

if (yourAnswer == 3)

{

cout << goodAnswer1;

delay(3000);

correctAnswers++; // Increases correctAnswers by one

score = 100; // Sets score to 100

}

if (yourAnswer != 3)

{

cout << badAnswer1;

delay(3000);

score = 0;

walkAway();

}

}

void answer2()

{

clrscr();

cout << question2;

cout << "1. $.75 \n";

cout << " 4. $1.00\n";

cout << numberOfAnswer2;

cin >> yourAnswer;

if (yourAnswer == 1)

{

cout << goodAnswer2;

delay(3000);

correctAnswers++;

score = 200;

}

if (yourAnswer != 1)

{

cout << badAnswer2;

delay(3000);

score = 0;

walkAway();

}

}

void answer3()

{

clrscr();

cout << question3;

cout << " 2. Cherry\n";

cout << " 4. Magnolia\n";

cout << numberOfAnswer2;

cin >> yourAnswer;

if (yourAnswer == 2)

{

cout << goodAnswer3;

delay(3000);

correctAnswers++;

score = 300;

}

if (yourAnswer != 2)

{

cout << badAnswer3;

delay(3000);

score = 0;

walkAway();

}

}

void answer4()

{

clrscr();

cout << question1;

cout << "1. A = B + C \n";

cout << " 4. A = C \n";

cout << numberOfAnswer2;

cin >> yourAnswer;

if (yourAnswer == 4)

{

cout << goodAnswer4;

delay(3000);

correctAnswers++;

score = 500;

}

if (yourAnswer != 3)

{

cout << badAnswer4;

delay(3000);

score = 0;

walkAway();

}

}

void answer5()

{

clrscr();

cout << question5;

cout << "1. 600 \n";

cout << "3. 300 \n";

cout << numberOfAnswer2;

cin >> yourAnswer;

if (yourAnswer == 1)

{

cout << goodAnswer5;

delay(3000);

correctAnswers++;

score = 1000;

}

if (yourAnswer != 1)

{

cout << badAnswer5;

delay(3000);

score = 0;

walkAway();

}

}

void answer6()

{

clrscr();

cout << question6;

cout << "1. Lassie 2. Old Yeller\n";

cout << " \n";

cout << numberOfAnswer2;

cin >> yourAnswer;

if (yourAnswer == 1)

{

cout << goodAnswer6;

delay(3000);

correctAnswers++;

score = 2000;

}

if (yourAnswer != 1)

{

cout << badAnswer6;

delay(3000);

score = 1000;

walkAway();

}

}

void answer7()

{

clrscr();

cout << question7;

cout << "1. Jerry Lee Lewis \n";

cout << " 4. Elvis Presley\n";

cout << numberOfAnswer2;

cin >> yourAnswer;

if (yourAnswer == 4)

{

cout << goodAnswer7;

delay(3000);

correctAnswers++;

score = 4000;

}

if (yourAnswer != 1)

{

cout << badAnswer7;

delay(3000);

score = 1000;

walkAway();

}

}

void answer8()

{

clrscr();

cout << question8;

Страницы: 1, 2, 3, 4



© 2003-2013
Рефераты бесплатно, курсовые, рефераты биология, большая бибилиотека рефератов, дипломы, научные работы, рефераты право, рефераты, рефераты скачать, рефераты литература, курсовые работы, реферат, доклады, рефераты медицина, рефераты на тему, сочинения, реферат бесплатно, рефераты авиация, рефераты психология, рефераты математика, рефераты кулинария, рефераты логистика, рефераты анатомия, рефераты маркетинг, рефераты релиния, рефераты социология, рефераты менеджемент.