如何填写用户输入C#数组? [英] How to Fill an array from user input C#?

查看:610
本文介绍了如何填写用户输入C#数组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是填写用户输入一个数组的最佳方法是什么?



请问一个解决方案是显示一个提示信息,然后从用户那里得到的值?


解决方案

 的String [] =回答新的字符串[10]; 
的for(int i = 0; I< answer.length;我++)
{
答案[I] =到Console.ReadLine();
}


What would be the best way to fill an array from user input?

Would a solution be showing a prompt message and then get the values from from the user?

解决方案

string []answer = new string[10];
for(int i = 0;i<answer.length;i++)
{
	answer[i]= Console.ReadLine();
}

这篇关于如何填写用户输入C#数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆