平安夜到了,这里祝我所有以前的现在的朋友们平安夜快乐。
特别感谢:梨子,小虞妹妹,MOCA~学妹,小兰,晓莉,月蓉和以前的好多好多同学
今天是平安夜,写了个程序,祝我的朋友们圣诞快乐
代码如下:Copy it free
![]()
Code
1
using System;
2
using System.Collections.Generic;
3
using System.Text;
4![]()
5
namespace MerryChristmas
6![]()
![]()
{
7
struct study
8![]()
{
9
public int EveryClassScore;
10
public Char TheMarkOfMajorClass; //好成绩不怕拿出来炫
11
public int AverageScore;
12
}
13
class CollegeLife
14![]()
{
15
string YourName;
16
private study Smooth_Study;
17
private String A_Good_Company; //有需要的话就找个GG/MM陪你度过大学生活吧
18
public CollegeLife(string Name, string Company)
19![]()
{
20
YourName = Name;
21
A_Good_Company = Company; //找个好朋友一起度过整个大学生活吧,好朋友可不一定要男女朋友哦
22
Smooth_Study.EveryClassScore = Program.ra.Next(70, 100); //每门课只求过就可以了
23
Smooth_Study.TheMarkOfMajorClass = 'A'; //专业课以后要混饭吃的,要有个好成绩哦
24
Smooth_Study.AverageScore = Program.ra.Next(this.Smooth_Study.EveryClassScore,100); //最后所有课程的平均成绩可不能太低
25
}
26
public CollegeLife(string Name)
27
: this(Name,null)//没人陪就用这个构造函数吧。
28![]()
{
29
}
30
public void Show_My_College_Life()
31![]()
{
32
if (A_Good_Company != null)
33
Console.WriteLine(this.YourName + "将会和" + this.A_Good_Company + "度过了愉快的大学生活");
34
Console.WriteLine("大学生活中你每门课的成绩都在"+this.Smooth_Study.EveryClassScore+"之上");
35
Console.WriteLine("而且每门专业课成绩都是A");
36
Console.WriteLine("大学课程的平均成绩达到了" + this.Smooth_Study.AverageScore + "之上\n");
37
}
38
}
39
class Program
40![]()
{
41
static public Random ra = new Random();
42
static void Main(string[] args)
43![]()
{
44
CollegeLife 小虞妹妹=new CollegeLife ("小虞妹妹","Samson小天");
45
CollegeLife Moca学妹 = new CollegeLife("Moca学妹", "Samson小天");
46
CollegeLife 小兰 = new CollegeLife("小兰", "Samson小天");
47
CollegeLife 梨子 = new CollegeLife("梨子", "Samson小天");
48
小虞妹妹.Show_My_College_Life();
49
Moca学妹.Show_My_College_Life();
50
小兰.Show_My_College_Life();
51
梨子.Show_My_College_Life();
52
Console.WriteLine("\n\n哈哈,最后祝大家圣诞快乐。 ---Samson Product");
53
Console.ReadKey();
54
}
55
}
56
}
57
运行后如下:
![]()
成绩什么的都是随机生成的,但是能保证是70分上的,低了表打我啊,^-^
最后祝我所有的朋友们平安夜快乐,明年也是平平安安,快快乐乐!
代码如下:Copy it free
1
using System;2
using System.Collections.Generic;3
using System.Text;4

5
namespace MerryChristmas6


{7
struct study8

{9
public int EveryClassScore;10
public Char TheMarkOfMajorClass; //好成绩不怕拿出来炫11
public int AverageScore;12
}13
class CollegeLife14

{15
string YourName;16
private study Smooth_Study;17
private String A_Good_Company; //有需要的话就找个GG/MM陪你度过大学生活吧18
public CollegeLife(string Name, string Company)19

{20
YourName = Name;21
A_Good_Company = Company; //找个好朋友一起度过整个大学生活吧,好朋友可不一定要男女朋友哦22
Smooth_Study.EveryClassScore = Program.ra.Next(70, 100); //每门课只求过就可以了23
Smooth_Study.TheMarkOfMajorClass = 'A'; //专业课以后要混饭吃的,要有个好成绩哦24
Smooth_Study.AverageScore = Program.ra.Next(this.Smooth_Study.EveryClassScore,100); //最后所有课程的平均成绩可不能太低25
}26
public CollegeLife(string Name)27
: this(Name,null)//没人陪就用这个构造函数吧。28

{29
}30
public void Show_My_College_Life()31

{32
if (A_Good_Company != null)33
Console.WriteLine(this.YourName + "将会和" + this.A_Good_Company + "度过了愉快的大学生活");34
Console.WriteLine("大学生活中你每门课的成绩都在"+this.Smooth_Study.EveryClassScore+"之上");35
Console.WriteLine("而且每门专业课成绩都是A");36
Console.WriteLine("大学课程的平均成绩达到了" + this.Smooth_Study.AverageScore + "之上\n");37
}38
}39
class Program40

{41
static public Random ra = new Random();42
static void Main(string[] args)43

{44
CollegeLife 小虞妹妹=new CollegeLife ("小虞妹妹","Samson小天");45
CollegeLife Moca学妹 = new CollegeLife("Moca学妹", "Samson小天");46
CollegeLife 小兰 = new CollegeLife("小兰", "Samson小天");47
CollegeLife 梨子 = new CollegeLife("梨子", "Samson小天");48
小虞妹妹.Show_My_College_Life();49
Moca学妹.Show_My_College_Life();50
小兰.Show_My_College_Life();51
梨子.Show_My_College_Life();52
Console.WriteLine("\n\n哈哈,最后祝大家圣诞快乐。 ---Samson Product");53
Console.ReadKey();54
}55
}56
}57

运行后如下:
成绩什么的都是随机生成的,但是能保证是70分上的,低了表打我啊,^-^
最后祝我所有的朋友们平安夜快乐,明年也是平平安安,快快乐乐!
浙公网安备 33010602011771号