Page 30 - ePB316_最佳案例 Visual Basic 2017 程式設計
P. 30
Visual Basic 2017 程式設計
ɚe੬ᅰୌٙ܁ѓ
༧ᜊᅰɓᅵd੬ᅰୌ˸ɨᔊ၈੬ᅰ͵ცࠅৣໄাኳdၾᜊᅰʔΝٙ݊d
੬ᅰୌ͍νՉΤ၈הͪdίࡈόʕேʔึҷᜊՉ࠽d݂၈މ੬ᅰfόணࠇ
ʕdϞՇ၇ڌͪ੬ᅰٙ˙όj(1) ɓ၇݊˖οόLiteralfԷνjٜટ˸ 15 א 3.14159
ڌͪݔɓ੬ᅰi(2) ̤ɓ၇ۆ͉݊ఊʩהࠅʧୗٙ੬ᅰୌόSymbolicfʘה˸
ცࠅ੬ᅰୌd݊ΪމϞԬᅰοίόʕึʔᓙٙࠠል̈ତdމəᄣ̋ό̙ٙᛘ
ʿಯˇόᒟɝٙ௦dϤࣛу̙͜ɓࡈϞจ່ٙୌ˾ಁdШ̀ίୌʘۃ
̋ɪڭवο Constdۆ༈ୌٙ࠽ਗ਼͑Ⴣڭܵίה܁ѓٙୌʕdόʕОЗໄѩ
ʔঐҷᜊՉ࠽dϤ၈މ੬ᅰୌdᔊ၈੬ᅰfԷνjлࢹٙࠇၑdᏐਗ਼лଟ RATE
ணމ੬ᅰf
Const RATE=0.2
ۆӊϣࠅԴ͜лଟࣛd̥ࠅ෬ɝ RATE у̙ൗ ੬ᅰୌஷ੬ਗ਼ӊɓࡈο͎ѩ͜ɽᄳڌ
ͪfܙϞಃɓ˚̀ሜлଟࣛd̥ࠅίόٙ௰ۃࠦࡌҷϤ੬ᅰୌٙ࠽у̙f
߰͊Դ͜੬ᅰୌ୕ɓϤ࠽dۆΪϤ੬ᅰໝόήϾೌجᆽڭϤ࠽ٙɓߧf
˸ɨાࠑ݊੬ᅰ܁ѓٙႧجd˲ʔܸ͜ݼՉۨйfVB ਗ਼ึԱה፩ɝٙ࠽d፯௰
ቇٙাኳৣໄf
Const ੬ᅰᗆйο = ੬ᅰ
א٫dЫɰ̙˸ܸݼՉۨйf
Const ੬ᅰᗆйο As ༟ࣘۨй = ੬ᅰ
˸ɨાࠑу݊܁ѓ੬ᅰ I = 3f
Const I = 3 ' ʔܸݼ I ٙۨй
א݊
Const I As Short = 3 ' ܸݼ I މᅰۨй
22