using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Test
{
/// <summary>
/// 自定义类,封装加数和被加数属性
/// </summary>
class MyClass
{
private int x = ; //定义int型变量,作为加数
private int y = ; //定义int型变量,作为被加数
/// <summary>
/// 加数
/// </summary>
public int X
{
get
{
return x;
}
set
{
x = value;
}
}
/// <summary>
/// 被加数
/// </summary>
public int Y
{
get
{
return y;
}
set
{
y = value;
}
}
/// <summary>
/// 求和
/// </summary>
/// <returns>加法运算和</returns>
public int Add()
{
return X + Y;
}
}
class Program
{
static void Main(string[] args)
{
MyClass myclass = new MyClass(); //实例化MyClass的对象
myclass.X = ; //为MyClass类中的属性赋值
myclass.Y = ; //为MyClass类中的属性赋值
int kg = myclass.Add();
Console.WriteLine(kg); //调用MyClass类中的Add方法求和
Console.ReadLine();
}
}
}
public class TestDoWhile
{
static void Main ()
{
int x = 0;
do
{
Console.WriteLine(x);
x++;
} while (x < 10);
}
}
/*
class ForTest
{
static void Main()
{
for (int i = 1; i <= 10; i++)
{
Console.WriteLine(i);
}
}
}
/*
for (; ; )
{
// ...
}
class ForEachTest
{
static void Main(string[] args)
{
int[] barray = new int[] { 0, 1, 2, 3, 4, 5};
foreach (int i in barray)
{
System.Console.WriteLine(i);
}
}
}
/*
class WhileTest
{
static void Main()
{
int n = 1;
while (n < 5)
{
Console.WriteLine(n);
n++;
}
}
}
/*
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有