c#小例子

前言
C#视频也看了好久了,总结一些小知识点。

while和do while的区别
while 循环一次都不执行:直接判断
do-while 循环会执行一次:先执行后判断
程序调试
1.设置断点(在行号钱点击空白处)
2.单步运行(F11逐语句调试)
3 观察变量(鼠标放到变量名上观察)
4 F10逐过程调试

三种循环
for while do-while
一般知道了循环的次数 for
不知道循环次数 while do-while
先执行 do-while
先判断 while

乘法表思路
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 长方形乘法表
{
class Program
{
static void Main(string[] args)
{
for (int j = 1; j <= 9; j++)
{
for (int i = 1; i <= 9; i++)
{
Console.WriteLine("{0}{1}={2}\t ", i,j,ij);

}
Console.WriteLine();
}
Console.ReadKey();

}
}
}
break用法
跳出当前循环

猜你喜欢

转载自blog.csdn.net/m0_46151596/article/details/120447291