云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > C#程序设计实验报告实验指导书-邵佳楠

C#程序设计实验报告实验指导书-邵佳楠

  • 62 次阅读
  • 3 次下载
  • 2025/5/5 19:00:35

金陵科技学院实验报告

2、编写一个Windows窗体应用程序,输入自己的班级、学号、姓名并显示。 using System;

using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text;

using System.Threading.Tasks; using System.Windows.Forms;

namespace WindowsFormsApplication2 {

public partial class Form1 : Form {

public Form1() {

InitializeComponent(); }

private void button1_Click(object sender, EventArgs e) {

MessageBox .Show (\班级:\姓名:\+\学号:\

} } }

3

金陵科技学院实验报告

3、编写一个程序,用来判断输入的是大写字母,小写字母,数字还是其他的字符(if)。 using System;

using System.Collections.Generic; using System.Linq; using System.Text;

using System.Threading.Tasks; namespace ConsoleApplication1 {

class Program {

static void Main(string[] args) {

Console.WriteLine(\请输入一个字符:\

char c = Convert.ToChar(Console.ReadLine()); if (c >= 'a' && c <= 'z')

Console.WriteLine(\该字母是小写字母\ else if (c >= 'A' && c <= 'Z')

Console.WriteLine(\该字母是大写字母\ else if (char.IsDigit(c))

Console.WriteLine(\该字母是数字\ else

Console.WriteLine(\其它字符\ Console.ReadLine(); } } }

4

金陵科技学院实验报告

4、编写一个程序,实现简单的加、减、乘、除的运算(switch)。 using System;

using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text;

using System.Windows.Forms;

namespace WindowsFormsApplication3 {

public partial class Form1 : Form {

public Form1() {

InitializeComponent(); }

private void button1_Click(object sender, EventArgs e) {

int num1 = int.Parse(txtnum1.Text); int num2 = int.Parse(txtnum2.Text); switch (txtop.Text) {

case \

txtresult.Text = (num1 + num2) + \ case \

txtresult.Text = (num1 - num2) + \ case \

txtresult.Text = (num1 * num2) + \ case \

txtresult.Text = (num1 / num2) + \ default:

txtresult.Text = \ }

5

金陵科技学院实验报告

} } }

5、定义一个一维数组,通过键盘输入10个两位整数,用foreach循环输出其中的内容。 并求出其中的最大值和平均值,把结果显示出来。 using System;

using System.Collections.Generic; using System.Linq; using System.Text;

using System.Threading.Tasks; namespace ConsoleApplication2 {

class Program {

static void Main(string[] args) {

int[] a = new int[10]; int i = 0;

while (i < a.Length) {

Console.Write(\请输入第{0}个数据:\ a[i] = Convert.ToInt32(Console.ReadLine()); if (a[i] >= 10 && a[i] <= 99) i++; }

Console.Write(\数组内容为:\ foreach (int j in a) {

Console.Write(\ }

Console.WriteLine();

Console.WriteLine(\最大值: \ Console.WriteLine(\平均值: \ Console.ReadLine(); } } }

6

  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

金陵科技学院实验报告 2、编写一个Windows窗体应用程序,输入自己的班级、学号、姓名并显示。 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApplication2 { public partial class Form1 : Form {

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com