// The ACM progress has been slowed down. This is the first half of the semester. I will make up the missed lessons and start C # learning.
03rd lab Question 1
1. Write a console application. Enter a group of Integers to output all odd numbers.
Tip: Use the string Split Function
Usage of the Split function:
The Split function returns a zero-dimensional array containing a specified number of substrings.
Syntax
Split (expression [, delimiter [, count [, start])
The syntax of the Split function includes the following parameters:
Parameter description
Expression is required. A string expression that contains a substring and a separator. If expression is a zero-length string, Split returns an empty array, that is, an array that does not contain elements and data.
Delimiter is optional. Character used to identify the substring boundary. If omitted, use space ("") as the separator. If delimiter is a zero-length string, a single element array containing the entire expression string is returned.
Count is optional. Number of substrings to be returned.-1 indicates that all substrings are returned.
Compare is optional. Indicates the value of the comparison type used to calculate the substring. For values, see the "Settings" section.
Set
The compare parameter can have the following values:
Constant Value description
VbBinaryCompare 0 performs binary comparison.
VbTextCompare 1 performs text comparison.
See http://www.cnblogs.com/gergro/archive/2006/04/06/368598.html for details
Code:
/*** Author: CY _ * experiment 3_1 * indicates the number of input strings, and all the odd numbers are output */using System; using System. collections. generic; using System. linq; using System. text; using System. threading. tasks; namespace test3_1 {class Program {static void Main (string [] args) {Odd. oddNumber () ;}} class Odd {public static void oddNumber () {Console. writeLine ("input integer, separated by ',':"); string x = Console. readLine (); string [] n = x. split (','); for (int I = 0; I
Run:
Zookeeper