- 2
Help! c# tutorial final question Module 9
Dictionary< , int> d = Dictionary<string, >(); .Add("John", 24); d.Add("Ann", 18); d.Add("Peter", 27); string name = "John"; Console.Write(d name );
6 Antworten
+ 6
Dictionary<string, int> d = new Dictionary<string, int>();
d.Add("John", 24);
d.Add("Ann", 18);
d.Add("Peter", 27);
string name = "John";
Console.Write(d[name]);
0
Dictionary<string, int> d =
new Dictionary<string, int>();
d.Add("John", 24);
d.Add("Ann", 18);
d.Add("Peter", 27);
string name = "John";
Console.Write(d[name]);
0
Answer:
Dictionary<string, int> d = new Dictionary<string, int>();
d.Add("John", 24);
d.Add("Ann", 18);
d.Add("Peter", 27);
string name = "John";
Console.Write(d[name]);
0
Answer
Dictionary<string, int> d = New Dictionary<string,int >();
d.Add("John", 24);
d.Add("Ann", 18);
d.Add("Peter", 27);
string name = "John";
Console.Write(d[name]);
0
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
foreach (KeyValuePair<string, int> entry in coffee)
{
Console.WriteLine(entry.Key + ": " + (entry.Value - entry.Value * discount / 100));
}
}
0
Dictionary<
string
, int> d =
new
Dictionary<string,
int
>();
d
.Add("John", 24);
d.Add("Ann", 18);
d.Add("Peter", 27);
string name = "John";
Console.Write(d
[
name
]
);