欢迎光临散文网 会员登陆 & 注册

geren

2023-06-27 17:06 作者:宗师魂六  | 我要投稿

71页计算器(重点)
计算按键代码
double x = double.Parse(textBox1.Text);
double y = double.Parse(textBox2.Text);
if (radioButton1.Checked)labe4.Text = Convert.Tostring(x   y);
if (radioButton1.Checked)labe4.Text = Convert.Tostring(x - y);
if (radioButton1.Checked)labe4.Text = Convert.Tostring(x * y);
if (radioButton1.Checked)labe4.Text = Convert.Tostring(x / y);
if (radioButton1.Checked)labe4.Text = Convert.Tostring(x % y);
退出按键代码
Application.Exit();



97页最大值
           double[] a = new double[5];
           double min, max;
           Console.WriteLine("请输入五个数:");
           for (int i = 0; i <= 4; i  )
               a[i] = Convert.ToDouble(Console.ReadLine());
           min = a[0];
           max = a[0];
           for (int i = 1; i <= 4; i  )
           {
               if (min > a[i])
                   min = a[i];
               if (max > a[i])
                   max = a[i];
           }
           Console.Write("数组中的五个数为:");
           for (int i = 0; i <= 4; i  )
               Console.Write("{0}", a[i]);
           Console.WriteLine();
           Console.WriteLine("数组中的最大值为:{0},最小值为:{1}", max, min);
144页相册(重点)
上一张按钮
if (btnNext.Enabled == false)
   btnNext.Enabled == trur;
pictureBox1.Imge = imageList1.Images[ - - i];
if(i == 0)
  btnPre.Enabled = false;
下一张按钮
if (btnNext.Enabled == false)
   btnNext.Enabled == trur;
pictureBox1.Imge = imageList1.Images[     i];
if(i == imageList1.ImageList1.Images.Count - 1)
  btnNext.Enabled = false;
210第四题
namespace sttuu
{
   class Program
   {
       class Student
       {
           private string name;
           private char sex;
           private int age;

           public string Name                  //获取属性
           {
               get { return name; }
               set { name = value; }
           }
           public char Sex
           {
               get { return sex; }
               set { sex = value; }
           }
           public int Age
           {
               get { return age; }
               set { age = value; }
           }

           public Student(string name,char sex) //构造两个参数的方法
           {
               Name = name;
               Sex = sex;
           }
           public Student(string name, char sex, int age) //构造三个参数的方法
           {
               Name = name;
               Sex = sex;
               Age = age;
           }

           public void Introduce()
           {
               Console.WriteLine("大家好,我叫" Name "我是一个" Sex "孩,我今年" Age "岁");
           }
       }
       static void Main(string[] args)
       {
           Student s1 = new Student("lily",'女');
           s1.Introduce();
           Student s2 = new Student("zhangsan",'男',18);
           s2.Introduce();

       }
   }
}
211第五题
namespace bk
{
   class Program
   {
       class Book
       {
           private string title;        //定义两个字段
           private int pageNum;

           public string Title
           {
               get { return title; }
               set { title = value; }
           }
           public int PageNum
           {
               get { return pageNum; }
               set { pageNum = value; }
           }

           public void Detail()
           {
               Console.WriteLine("书籍的名称为" Title "页数为" PageNum);
           }
       }
       static void Main(string[] args)
       {
           Book book = new Book();
           book.Title = "c#";
           book.PageNum = 500;
           book.Detail();
       }
   }
}


geren的评论 (共 条)

分享到微博请遵守国家法律