snrg.net
当前位置:首页 >> 用C#设计一个控制台程序,要求用户输入10个数,并... >>

用C#设计一个控制台程序,要求用户输入10个数,并...

见下面代码 using System;using System.Collections.Generic;using System.Text;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { double [] myArray = new double[10]; Console.WriteLine("请输入十个数"); ...

class Program { // 声明委托 public delegate Double SquareCallback(Double x, Double y); public static Double GetSumResult(Double x, Double y) { return Math.Pow(x, 2)+Math.Pow(y,2); } public static Double GetSubtractionResult(Dou...

using System; using System.Console; class Program { public static void Main(string [] args) { int a = Integer.Parse(Console.Read()); int b = Integer.Parse(Console.Read()); Console.Write("{0}+{1}={2}\n",a,b,a+b); } } 大概这样,...

class Program{ static void Main(stringp[] args) { Console.WriteLine("输入多个值,以空格分隔"); string value = Console.ReadLine(); string[] vals = value.Split(' '); Console.WriteLine("分开展示各值"); for (int i = 0; i < vals.Len...

int i=0,j=0;//先定义两个变量接受输入的值 if(int.TryParse(Console.ReadLine(),out i) { if(int.TryParse(Console.ReadLine(),out j)) { Console.WriteLine(string.Format("{0}*{1}={2}",i,j,i*j)); Console.ReadKey(); } }

static void Main(string[] args) { int n = 0; n = Convert.ToInt32(Console.ReadLine()); int result = sum(n); Console.WriteLine(result.ToString()); Console.ReadLine(); } private static int sum(int n) { int j = 1; //结果 int result...

Main 函数里写: Console.Write("请输入一个字符串:"); string str = Console.ReadLine(); int count = 0;foreach (char c in str){ if (char.IsLetter(c)) { count ++; }}Console.WriteLine(string.Format("字符串{0}中字母的个数为:{1}", st...

static void Main(string[] args) { Console.WriteLine("请输入要排序的数字个数(必须是正整数)"); int Count = Convert.ToInt32(Console.ReadLine()); List list = new List(); for (int i = 0; i < Count; i++) { Console.WriteLine("请输入第...

namespace ConsoleApplication3{ class Program { static void Main(string[] args) { int sum = 0; int v = int.Parse(Console.ReadLine()); do { int n = v % 10; sum += n; v /= 10; } while (v != 0); Console.WriteLine(sum); } } }

/* (程序头部注释开始) * 输入描述: * 问题描述:设计一个程序,输入10个数存入数组中,求最大值、最小值和平均值. * 程序输出: * 程序头部的注释结束 */ using System; using System.Collections.Generic; using System.Linq; using System.T...

网站首页 | 网站地图
All rights reserved Powered by www.snrg.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com