1 輸入一數值成績,100-90 = A;89-80=B;79-70=C;69-60=D;其餘為E
2 請輸入一數值字串(如:”67345Abc”)進行由大至小排序。
3 輸入一字串,將字串加7後,輸出結果。
可以用冒泡排序法
using System;
namespace maopao
{
/// <summary>
/// Class2 的摘要说明。
/// </summary>
public class Class2
{
public void Sotr(int[] list)
{
int i,j,temp;
bool done;
for(j=0;j<list.Length;j++)
{
done=false;
for(i=list.Length-2;i>=j;i--)
{
if(list[i]>list[i+1])
{
temp=list[i];
list[i]=list[i+1];
list[i+1]=temp;
done=true;
}
}
if(!done)
{
break;
}
}
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.Height = 265;
label1.Text = DateTime.Now.Year.ToString();
label3.Text = DateTime.Now.Month.ToString();
label5.Text = DateTime.Now.Day.ToString();
switch (DateTime.Now.DayOfWeek.ToString())
{
case "Monday": label7.Text = "星期一";
case "Tuesday": label7.Text = "星期二";
case "wednesday": label7.Text = "星期三";
case "Thursday": label7.Text = "星期四";
case "Friday": label7.Text = "星期五";
case "Saturday": label7.Text = "星期六";
case "Sunday": label7.Text = "星期日";
break;
}
for (int i = -40; i < 45; i++)
{
string tem = i.ToString() + "度";
comboBox1.Items.Add(tem);
comboBox2.Items.Add(tem);
}
comboBox1.Text = "15度";
comboBox2.Text = "25度";
radioButton1.Checked = true;
label9.Text = "晴";
label11.Text = comboBox1.Text;
label13.Text = comboBox2.Text;
}
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
label9.Text = "晴";
}
private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
label9.Text = "阴";
}
private void radioButton3_CheckedChanged(object sender, EventArgs e)
{
label9.Text = "雨";
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
label11.Text = comboBox1.Text;
}
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
{
label13.Text = comboBox2.Text;
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
if (checkBox1.Checked == true)
this.Height = 425;
else
this.Height = 265;
}
private void timer1_Tick(object sender, EventArgs e)
{
label1.Text = DateTime.Now.Year.ToString();
label3.Text =DateTime.Now.Month.ToString();
label5.Text = DateTime.Now.Day.ToString();
switch (DateTime.Now.DayOfWeek.ToString())
{
case "Monday": label7.Text = "星期一";
break;
case "Tuesday": label7.Text = "星期二";
break;
case "Wednesday": label7.Text = "星期三";
break;
case "Thursday": label7.Text = "星期四";
break;
case "Friday": label7.Text = "星期五";
break;
case "Saturday": label7.Text = "星期六";
break;
case "Sunday": label7.Text = "星期日";
break;
}
}
}
}
各位高手帮忙看下,这代码出了什么问题,老是不成功的,谢谢