c sharp资料.docVIP

  • 9
  • 0
  • 约 21页
  • 2016-11-17 发布于天津
  • 举报
c sharp资料.doc

作业1:设计日期结构 1、定义日期结构;2、包括三个字段:年、月、日;3、设计日期输出函数,输出格式为,{0}年{1}月{2}日;4、在主函数中进行测试。5、参考PPT上的点结构格式。 using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication2 { struct Date { int year, month, date; public void sr(int year,int month,int date) { this.year=year; this.month=month; this.date=date; } public void display() { Console.WriteLine({0}年{1}月{2}日,year,month,date); } }; class Program { static void Main(string[] args) { Date p=new Date(); p.sr(2012,2,21); p.display(); } } } 实验1、计算最小公倍数和最大公约数 1、设计Leastmultiple类,求两个数的最小公倍数;2、设计Greatestdivisor类

文档评论(0)

1亿VIP精品文档

相关文档