|
saya ni baru lagi dalam c#, so nak mintak tlg sikit
contoh saya nak buat program mcm ni:
//menu
code book price
1 novel 40.00
2 magazine 30.00
3 comic 10.00
- switch (code)
- {
- case 1: price = 40.00;
- break;
- case 2: price = 30.00;
- break;
- case 3: price = 10.00;
- break;
- default:Console.WriteLine("Invalid code");
- break;
- }
Copy the Code
contoh saya nak beli 2 buku:
//output
receipt details:
date:
cashier:
list of items: 1 novel RM40.00
3 comic RM10.00
total:RM50.00
cash:
change:
soalan saya mcm mana nak display list of items tu? yang lain sume dah dpt display..ade idea tak?tolong please |
|
|
|
|
|
|
|
takde orang nak tolong ke? |
|
|
|
|
|
|
|
letak dlm vector pastu print je la satu2. |
|
|
|
|
|
|
|
la...komputer geek rupenye... kah kah kah..msti lobang idong ko besar dan ko rabon kan...kihkihkih
|
Rate
-
1
View Rating Log
-
|
|
|
|
|
|
|
utk select item more than 1... x sesuai utk method select case...
tp kalo nk juga buat dlm case.. letak do while before select case .. loop after end case..
tp better guna direct "for... next" or "do while... loop"
contoh- for each (inputvalue)
- if inputvalue = 1 than
- item1 = item1 & "RM 10.00" & vbcrlf
- elseif inputvalue = 2 then
- item1 = item1 & "RM 20.00" & vbcrlf
- elseif inputvalue = 3 then
- item1 = item1 & "RM 30.00" & vbcrlf
- next
- consolte.writeline (item1.tostring)...
Copy the Code so vbcrkf tuh ada lah enter ke bawah dlm console application...
satu soalan... mmg plan nk buat output dalam console application ka? alang2 tuh... buat tros je windows application.. baru nampak GUI sket..
|
|
|
|
|
|
|
|
c# x tau, c++ ley la tlng... |
|
|
|
|
|
|
| |
|