
(1)编程输出1到100中能被3整除但不能被5整除的数,并统计有多少个这样的数。
(2)创建一个控制台应用程序,编写一个函数将十进制数转换成二进制数。程序可以
让用户一直进行转换,直到输入0为止。程序中要对格式转换异常进行处理。
(3)创建一个类,它存储一个int数据成员MyNumber,并给该数据成员创建属性,当该数据成员被存储时,将其乘以100;当其被读取时,将其除以100。
(4)设计一个类,要求用事件每10秒报告机器的当前时间。
(5)编写一个程序接受用户输入的字符。如果输入的字符是0-9数字中的一个,则显示“您输入了一个数字”,否则显示“这不是一个数字”。
(6)编写一个程序,该程序使用一个数组存储30个学生的考试成绩,并给各个数组元素指定一个1-100的随机值,要求利用索引来对数组中的元素进行赋值和显示。然后计算平均成绩。
(7)编写一个windows应用程序,能将窗体背景颜色1秒钟变换一次。
(8)通过方法重载,使用同一个方法名print分别执行输出整数、双精度数与字符串的功能。
1.
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
Main(string[] args)
能被3整除但不能被5整除的数 ");
共有 {0}个", sum);
}
2.
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication2
{
Main(string[] args)
{ Console.Write("输入一个十进制数(输入0为止):");
转换的二进制为:");
格式转换错误");
}
3.
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication3
{
Main(string[] args)
请输入任意一个数:");
结果为:");
}
4.
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
namespace ConsoleApplication4
{
public void TimerHandlerA(object obj, EventArgs e) // Event handler
Main()
ClassA ca = new ClassA(); // Create the class object.
MyTimerClass mc = new MyTimerClass(); // Create the timer object.
mc.Elapsed += ca.TimerHandlerA; // Add handler A -- instance.
}
5.
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
Main(string[] args)
请输入一个字符:");
您输入了一个数字");
这不是一个数字");
6.
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication2
{
Main(string[] args)
}
7.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace ConsoleApplication3
{
}
8.
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication4
{
Main(string[] args)
请输入一个整数:");
请输入一个双精度数:");
请输入一个字符串:");
}
}
