字串的各種操作
阿新 • • 發佈:2019-01-09
3.編寫一個控制檯應用。輸入一組整數,輸出所有的奇數。 提示:使用字串的Split函式 4.輸入一個由若干字元組成的字串,輸出其中的大寫字母、小寫字母、數字和其他字元的個數。 提示:使用ToCharArray函式 using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class MyClass { int[] m=new int[10]; public MyClass() { } public MyClass(int [] m1) { m=m1; } public int Exchange() { for (int i = 0; i < m.Length; i++) { if (m[i] / 2 != 0) return m[i]; } } ~MyClass() { } } class Program { static void Main(string[] args) { MyClass my = new MyClass(Console.ReadLine()); Console.WriteLine("所有的奇數為:"); int s=my.Exchange(); Console.WriteLine(s); Console.ReadLine(); } } }