{
字符串s =
char c;
int num = 0;
控制臺。WriteLine("請輸入壹個字符串\ n ");
s =控制臺。ReadLine();
控制臺。WriteLine("請輸入要計算的字符\ n ");
c =字符。解析(控制臺。ReadLine());
foreach(s . ToCharArray()中的char ch)
if (c == ch)
num++;
}
控制臺。WriteLine("您輸入的字符出現{0}次",num);