PRN292c_-_FA_2023_-_1_1180.webp
lanhoa86

PRN292c_-_FA_2023_-_1_1180.webp

  • Media owner lanhoa86
  • Ngày thêm
(Choose 1 answer)
What is the exact output of the below C# code?
static void Main(string[] args){
Dictionary<string, int> Cart = new Dictionary<string, int>();AddToCart(Cart, "A1", 3);
AddToCart(Cart, "A1", 1);
AddToCart(Cart, "A2", 5);
AddToCart(Cart, "A2", 1);AddToCart(Cart, "A1", 1);
foreach (KeyValuePair<string, int> KV in Cart){
Console.WriteLine($"(KV.Key} {KV.Value}");
}
}
static void AddToCart(Dictionary<string, int> Cart, string Newltem,
int Qty){
if (Cart ContainsKey(NewItem)){
Cart[NewItem] += Qty;
} else{
Cart[NewItem] = Qty;
}
}
A. A15
A2 6
B. A1 6
A25
C. A13
A2 1


Exit 33

Thông tin

Category
PRN292c
Thêm bởi
lanhoa86
Ngày thêm
Lượt xem
66
Lượt bình luận
1
Rating
0.00 star(s) 0 đánh giá

Image metadata

Filename
PRN292c_-_FA_2023_-_1_1180.webp
File size
59.6 KB
Dimensions
1542px x 690px

Share this media

Back
Bên trên Bottom