数组求最小值的c语言程序设计教程课后答案,c程序设计教程李春葆课后编程题答案.doc...

c程序设计教程李春葆课后编程题答案

输入a,b求c = a + b

using System;

using System.Collections.Generic;

using System.Text;

namespace Proj2_1

{

class Program

{

static void Main(string[] args)

{

int a, b, c;

Console.Write("a:");

a = int.Parse( Console.ReadLine());

Console.Write("b:");

b = int.Parse(Console.ReadLine());

c = a + b;

Console.WriteLine("a+b={0}", c);

}

}

}

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

namespace Proj2_2

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)

{

int a, b, c;

a = Convert.ToInt16(textBox1.Text);

b = Convert.ToInt16(textBox2.Text);

c = a + b;

textBox3.Text = Convert.ToString(c);

}

private void Form1_Load(object sender, EventArgs e)

{

}

private void textBox2_TextChanged(object sender, EventArgs e)

{

}

}

}

强制转换P38

using System;

using System.Collections.Generic;

using System.Text;

namespace Proj3_1

{

class Program

{

static void Main(string[] args)

{

int i=65,i1,i2;

double d = 66.3456,d1,d2;

char c = 'A',c1,c2;

Console.WriteLine("i={0:d5},d={1:f},c={2}", i, d, c);

i1 = (int)d; //强制类型转换

d1 = i;      //隐式类型转换

c1 = (char)i;  //强制类型转换

Console.WriteLine("i1={0:d5},d1={1:f},c1={2}", i1, d1, c1);

i2 = c; //隐式类型转换

d2 = (int)d; //强制类型转换

c2 = (char)d; //强制类型转换

Console.WriteLine("i2={0:d5},d2={1:f},c2={2}", i2, d2, c2);

}

}

}

赋值两同学信息数据,并在图中输出结果P44

using System;

namespace Proj3_2

{cl

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值