0

Why the code below generate error (cs1061), when I run it in solo learn, but it is ok when I run it in my laptop?

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { int discount = Convert.ToInt32(Console.ReadLine()); Dictionary<string, int> coffee = new Dictionary<string, int>(); coffee.Add("Americano", 50); coffee.Add("Latte", 70); coffee.Add("Flat White", 60); coffee.Add("Espresso", 60); coffee.Add("Cappuccino", 80); coffee.Add("Mocha", 90); //your code goes here int r; double d; foreach(string c in coffee.keys) { d=(double)discount/100; r=(Int32)((1-d)*coffee[c]); Console.WriteLine("{0}: {1}", c, r); } } } }

22nd Oct 2021, 3:34 AM
Budiman Budiman
Budiman Budiman - avatar
3 ответов
+ 2
Please, copy the code to the playground, save it and post the link to it.
22nd Oct 2021, 3:43 AM
ChaoticDawg
ChaoticDawg - avatar
+ 1
Budiman Budiman There should be 'k' Caps in keys it's Keys
22nd Oct 2021, 6:45 AM
A͢J
A͢J - avatar