fork download
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace ProgrammingLanguagesDictionary
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. // Create a dictionary of programming languages and their descriptions
  11. Dictionary<string, string> languageDict = new Dictionary<string, string>();
  12.  
  13. // Add programming languages with descriptions
  14. languageDict.Add("Python", "High-level, interpreted language great for data science and web development");
  15. languageDict.Add("JavaScript", "Essential language for web development, runs in browsers and servers");
  16. languageDict.Add("Java", "Object-oriented language known for 'write once, run anywhere' philosophy");
  17. languageDict.Add("C#", "Microsoft's object-oriented language for .NET framework development");
  18. languageDict.Add("C++", "Powerful system programming language, extension of C language");
  19. languageDict.Add("Ruby", "Dynamic, object-oriented language focused on simplicity and productivity");
  20. languageDict.Add("Go", "Google's language designed for modern distributed systems");
  21.  
  22. Console.WriteLine("Programming Languages Dictionary:");
  23. Console.WriteLine("=================================");
  24.  
  25. // Check if specific keys exist
  26. Console.WriteLine("\nChecking if languages exist in dictionary:");
  27. Console.WriteLine("Contains Python: " + languageDict.ContainsKey("Python"));
  28. Console.WriteLine("Contains PHP: " + languageDict.ContainsKey("PHP"));
  29.  
  30. // Display all programming languages and their descriptions
  31. Console.WriteLine("\nComplete Programming Languages Dictionary:");
  32. foreach (KeyValuePair<string, string> pair in languageDict)
  33. {
  34. Console.WriteLine("Language: " + pair.Key.PadRight(12) + " Description: " + pair.Value);
  35. }
  36.  
  37. // Display just the keys (language names)
  38. Console.WriteLine("\nJust the programming language names:");
  39. Dictionary<string, string>.KeyCollection keys = languageDict.Keys;
  40. foreach (string key in keys)
  41. {
  42. Console.WriteLine("Language: " + key);
  43. }
  44.  
  45. // Display just the values (descriptions)
  46. Console.WriteLine("\nJust the descriptions:");
  47. Dictionary<string, string>.ValueCollection values = languageDict.Values;
  48. foreach (string value in values)
  49. {
  50. Console.WriteLine("Description: " + value);
  51. }
  52.  
  53. Console.WriteLine("\nTotal number of programming languages in dictionary: " + languageDict.Count);
  54. }
  55. }
  56. }
Success #stdin #stdout 0.06s 28984KB
stdin
Standard input is empty
stdout
Programming Languages Dictionary:
=================================

Checking if languages exist in dictionary:
Contains Python: True
Contains PHP: False

Complete Programming Languages Dictionary:
Language: Python       Description: High-level, interpreted language great for data science and web development
Language: JavaScript   Description: Essential language for web development, runs in browsers and servers
Language: Java         Description: Object-oriented language known for 'write once, run anywhere' philosophy
Language: C#           Description: Microsoft's object-oriented language for .NET framework development
Language: C++          Description: Powerful system programming language, extension of C language
Language: Ruby         Description: Dynamic, object-oriented language focused on simplicity and productivity
Language: Go           Description: Google's language designed for modern distributed systems

Just the programming language names:
Language: Python
Language: JavaScript
Language: Java
Language: C#
Language: C++
Language: Ruby
Language: Go

Just the descriptions:
Description: High-level, interpreted language great for data science and web development
Description: Essential language for web development, runs in browsers and servers
Description: Object-oriented language known for 'write once, run anywhere' philosophy
Description: Microsoft's object-oriented language for .NET framework development
Description: Powerful system programming language, extension of C language
Description: Dynamic, object-oriented language focused on simplicity and productivity
Description: Google's language designed for modern distributed systems

Total number of programming languages in dictionary: 7