home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Info / TeachU14 / SAMS / Code / Day08 / ctmain.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-08  |  1.2 KB  |  37 lines

  1. //---------------------------------------------------------------------------
  2. #include <vcl\vcl.h>
  3. #pragma hdrstop
  4.  
  5. #include <stdlib.h>
  6. #include "CTMain.h"
  7. //---------------------------------------------------------------------------
  8. #pragma resource "*.dfm"
  9. TMainForm *MainForm;
  10. //---------------------------------------------------------------------------
  11. __fastcall TMainForm::TMainForm(TComponent* Owner)
  12.   : TForm(Owner)
  13. {
  14. }
  15. //---------------------------------------------------------------------------
  16. void __fastcall TMainForm::FormCreate(TObject *Sender)
  17. {
  18.   char colors[][10] =
  19.     {"Gray", "Blue", "Pink", "Orange", "Mauve"};
  20.   char critters[][10] =
  21.     {"Monkeys", "Pigs", "Dogs", "Bears", "Tapirs"};
  22.   // fill the listbox with random strings
  23.   randomize();
  24.   char buff[100];
  25.   for (int i=0;i<50;i++) {
  26.     wsprintf(buff, "Critter: %s %s",
  27.       colors[random(5)], critters[random(5)]);
  28.     DropDown->Items->Add(buff);
  29.     wsprintf(buff, "Critter: %s %s",
  30.       colors[random(5)], critters[random(5)]);
  31.     DropDownList->Items->Add(buff);
  32.     wsprintf(buff, "Critter: %s %s",
  33.       colors[random(5)], critters[random(5)]);
  34.     Simple->Items->Add(buff);
  35.   }
  36. }
  37. //---------------------------------------------------------------------