风景作文200字
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.Par( Console.ReadLine());
Console.Write("b:");
b = int.Par(Console.ReadLine());
c = a + b;
Console.WriteLine("a+b={0}", c);
}
}
}
using System;
意犹未尽造句
using System.Collections.Generic;
using /doc/f118e092b9f67c1cfad6195f312b3169a551ea3f.html ponentModel; using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Proj2_2
{
什么是4K电视机
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object nder, 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 nder, EventArgs e)
{
}
private void textBox2_TextChanged(object nder, 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
{ class Program
{ struct Student//类型声明应放在Main函数的外⾯
{ public int xh; //学号
public string xm; //姓名
public string xb; //性别
public int nl; //年龄
public string bh; //班号
}
static void Main(string[] args)
{ Student s1,s2; //定义两个结构类型变量
s1.xh = 101;
< = "李明";
s1.xb = "男";
s1.nl = 20;
s1.bh = "07001";
Console.WriteLine("学号:{0},姓名:{1},性别:{2},年龄:{3},班号:{4}", s1.xh, s1.xm, s1.xb, s1.nl, s1.bh);
s2 = s1; //将结构变量s1赋给s2
s2.xh = 108;
< = "王华";
Console.WriteLine("学号:{0},姓名:{1},性别:{2},年龄:{3},班号:{4}", s2.xh, s2.xm, s2.xb, s2.nl, s2.bh);
}
}
}
声明枚举类型color,给两成员赋值,定义三个变量,赋值运算输出相应值。P47 using System;
using System.Collections.Generic;
using System.Text;
namespace Proj3_3
{
class Program
{
enum Color { Red=5, Green, Blue, White=1, Black } //类型声明应放在Main函数的外⾯
static void Main(string[] args)
{
Color c1, c2,c3;
Console.WriteLine("Red={0},Green={1},Blue={2},White={3},Black={4}",Color.Red,Color.Green,Color.B lue,Color.White,Color.Black);
Console.WriteLine("Red={0},Green={1},Blue={2},White={3},Black={4}",(int)Color.Red,(int)Color.Gre en,(int)Color.Blue,(int)Color.White,(int)Color.Black);
c1 = Color.Red;
c2 = c1 + 1;
c3 = c2 + 1;
Console.WriteLine("c1={0},c2={1},c3={2}", c1, c2,c3);
Console.WriteLine("c1={0},c2={1},c3={2}", (int)c1, (int)c2,(int)c3); }
}
}
位运算符运⽤P50
using System;
using System.Collections.Generic;如懿传网盘
using System.Text;
namespace Proj3_4
{
class Program
{
static void Main(string[] args)
人间至爱{
byte b1, b2, b3;
b1 = 10;
b2 =(byte) ~b1;
Console.WriteLine(b2);
b3 = (byte)(b1 << 2);
Console.WriteLine(b3);
b1 = 3; b2 = 6;
b3 = (byte)(b1 & b2);
Console.WriteLine(b3);
b3 = (byte)(b1 ^ b2);
Console.WriteLine(b3);
b3 = (byte)(b1 | b2);
Console.WriteLine(b3);
}
}
}
输出常⽤数据类型所⽤字节数P52
using System;
using System.Collections.Generic;
using System.Text;
namespace Proj3_5
{
class Program
{
static void Main(string[] args)
怎样下载音乐
{
Console.WriteLine("byte类型所占字节数:{0}", sizeof(byte)); Console.WriteLine("char类型所占字节数:{0}", sizeof(char)); Console.WriteLine("int类型所占字节数:{0}", sizeof(int)); Console.WriteLine("float类型所占字节数:{0}", sizeof(float)); Console.WriteLine("double类型所占字节数:{0}", sizeof(double)); Console.WriteLine("decimal类型所占字节数:{0}", sizeof(decimal)); } }
}
求字符串⼦串在主串的位置P56
using System;
using System.Collections.Generic;
using System.Text;
namespace Proj3_6
{
class Program