iview循环数组怎么用ifrom 加校验
1个回答
展开全部
string []inputName = new string[5];
//用for循环结合数组完成输入操作
for (int i = 0; i < inputName.Length; i++){inputName[i] = Console.ReadLine();}//用for循环遍历数组,输出
using System.Collections.Generic;
using System.Linq;
using System.Text;namespace Example_ForArray{class Program{static void Main(string[] args){string[] inputName = new string[5];
//用for循环结合数组完成输入操作
for (int i = 0; i < inputName.Length; i++){Console.WriteLine("请输入学生姓名");
string str = Console.ReadLine();
if (str == ""){break;}else{inputName[i] = str;}}Console.Read();
//用for循环遍历数组,输出
for (int i = 0; i < inputName.Length; i++){Console.WriteLine("该数组的第{0}个元素是{1}", i + 1, inputName[i]);} }}}
//用for循环结合数组完成输入操作
for (int i = 0; i < inputName.Length; i++){inputName[i] = Console.ReadLine();}//用for循环遍历数组,输出
using System.Collections.Generic;
using System.Linq;
using System.Text;namespace Example_ForArray{class Program{static void Main(string[] args){string[] inputName = new string[5];
//用for循环结合数组完成输入操作
for (int i = 0; i < inputName.Length; i++){Console.WriteLine("请输入学生姓名");
string str = Console.ReadLine();
if (str == ""){break;}else{inputName[i] = str;}}Console.Read();
//用for循环遍历数组,输出
for (int i = 0; i < inputName.Length; i++){Console.WriteLine("该数组的第{0}个元素是{1}", i + 1, inputName[i]);} }}}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询