第一天
来源:互联网 发布:淘宝企业店铺 个体户 编辑:程序博客网 时间:2024/05/22 17:43
今天跟着老师巩固了一些过去所学基础知识 其中 我以前对于while的循环语句很是不能玩转 经过了今天
的复习 终于整明白了 但是还是习惯用for语句 觉得whlie用起来别扭 下面是我跟着老师写的一段whlie
语句的代码
Console.WriteLine("输入一个数");
string str = Console.ReadLine();
int max = Convert.ToInt32(str);
int temp = 0;
Console.WriteLine("输入一个数");
string input = Console.ReadLine();
while (input != "end")
{
temp = Convert.ToInt32(input);
if (temp > max)
{
max = temp;
}
Console.WriteLine("输入一个数");
input= Console.ReadLine();
}
Console.WriteLine(max);
下一个是规定while(true)的代码 虽然达到的效果和上面一样 但是经过对于条件的改动 代码也发生了
变化 Console.WriteLine("输入一个数");
string str = Console.ReadLine();
int max = Convert.ToInt32(str);
int temp = 0;
while (true)
{
Console.WriteLine("输入一个数");
string input = Console.ReadLine();
if (input == "end")
{
break;
}
temp=Convert.ToInt32(input);
if(temp>max)
{
max = temp;
}
}
Console.WriteL
- 第一天
- 第一天
- 第一天~
- 第一天
- 第一天
- 第一天
- 第一天
- 第一天
- #第一天
- 第一天
- 第一天
- 第一天
- 第一天
- 第一天
- 第一天
- 第一天
- 第一天
- 第一天
- php 图片 数据库
- COM原理笔记之一 —— 概述篇
- 20110223@6:00
- windows系统启动过程原理全面分析
- 红旗6.0 内核升级到2.6.37成功
- 第一天
- VSTF-Performance Testing
- java理论知识
- boost 记录
- [C#]使用DataSet Datatable 更新数据库的三种方式
- “WPF” VS “Silverlight”
- 如果做不到,闭上嘴!——leo鉴书(9)
- 【转载】再次写给我们这些浮躁的程序员
- CodeBlocks,cannot open output file permission denied的解决办法