70 likes | 81 Views
Learn about selection structures in Windows programming, including relational and logical operators, algorithms, sequential and selective structures, and the usage of TCheckBox, TRadioButton, and TGroupBox.
E N D
Chapter 5 Selection Structures Windows Programming, C.-S. Shieh, KUAS EC, 2005
5.1 Relational and Logical Operators • Relational Operators ==,!=, >, <, >=, <= • Logical Operators &&, ||, ! if(a==b && (x>1 || y<=0)) c=a; else c=b; Windows Programming, C.-S. Shieh, KUAS EC, 2005
5.2 Algorithms • Flow Chart • Algorithms Windows Programming, C.-S. Shieh, KUAS EC, 2005
5.3 Structural Programming • Sequential Structures • Selective Structures • if ( … ) … else … ; • … ? … : … Ex. x=(a>b)?a:b; • switch-case • Iterative Structures • for(… ; … ; … ) … ; • while( … ) … ; • do … while(…); Windows Programming, C.-S. Shieh, KUAS EC, 2005
5.6 TCheckBox • Presents an option that a user can toggle between Yes/No or true/false. • Properties • Caption (AnsiString), Checked (bool), Enabled (bool) • Events • OnClick Windows Programming, C.-S. Shieh, KUAS EC, 2005
5.7 TRadioButton • Radio buttons present a set of mutually exclusive options to the user. • Properties • Caption (AnsiString), Checked (bool), Enabled (bool) • Events • OnClick Windows Programming, C.-S. Shieh, KUAS EC, 2005
5.9 TGroupBox • Provides a container to group-related options on a form. • Properties • Caption (AnsiString), Enabled (bool) Windows Programming, C.-S. Shieh, KUAS EC, 2005