欢迎来到三一办公! | 帮助中心 三一办公31ppt.com(应用文档模板下载平台)
三一办公
全部分类
  • 办公文档>
  • PPT模板>
  • 建筑/施工/环境>
  • 毕业设计>
  • 工程图纸>
  • 教育教学>
  • 素材源码>
  • 生活休闲>
  • 临时分类>
  • ImageVerifierCode 换一换
    首页 三一办公 > 资源分类 > PPT文档下载  

    [计算机软件及应用]高级程序设计C第八章ppt课件.ppt

    • 资源ID:2047747       资源大小:2.85MB        全文页数:40页
    • 资源格式: PPT        下载积分:16金币
    快捷下载 游客一键下载
    会员登录下载
    三方登录下载: 微信开放平台登录 QQ登录  
    下载资源需要16金币
    邮箱/手机:
    温馨提示:
    用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP免费专享
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    [计算机软件及应用]高级程序设计C第八章ppt课件.ppt

    2023/1/3,1,高级程序设计,授课教师:祁长兴,C#,第八章:常用类,2023/1/3,2,常用类,2023/1/3,3,Math,静态字段PIE静态方法整数运算初等函数三角函数,Abs():求绝对值Ceiling()求大于等于指定数值的最小整数Floor()求小于或等于指定数值的最大整数Round()对数值进行四舍五入,Exp():求e的指数幂Pow()指数函数Log()对数函数Lg10()求以10为底的对数Sqrt()求平方根,Sin():求正弦函数Cos()求余弦函数Tan()求正切函数。,2023/1/3,4,static void Main(string args)double a=-1.2;int k=-1,d;double b,c;int i;b=Math.Abs(a);Console.WriteLine(Abs(a)=0,b);d=Math.Abs(k);Console.WriteLine(Abs(k)=0,d);c=Math.Ceiling(1.2);,Console.WriteLine(Ceiling(1.2)=0,c);c=Math.Floor(1.2);Console.WriteLine(Floor(1.2)=0,c);c=Math.Round(1.5);Console.WriteLine(Round(1.5)=0,c);c=Math.Round(1.2);Console.WriteLine(Round(1.2)=0,c);b=Math.Exp(2.1);Console.WriteLine(Exp(2.1)=0,b);b=Math.Pow(2,3);Console.WriteLine(Pow(2,3)=0,b);b=Math.Log(10);Console.WriteLine(Log(10)=0,b);b=Math.Log10(10);Console.WriteLine(Log10(10)=0,b);b=Math.Sqrt(9);Console.WriteLine(Sqrt(9)=0,b);Console.ReadLine();,2023/1/3,5,Math,DemoP8-1,2023/1/3,6,string,构造函数与赋值 1。直接赋值:string s1=“software”2。构造函数赋值:string(char,int)string(char)string(char,int,int),2023/1/3,7,static void Main(string args)string s1=helloworld!;Console.WriteLine(s1=0,s1);string s2=new string(a,5);Console.WriteLine(s2=0,s2);char s3=new charm,i,c,r,o,s,o,f,t;string s4=new string(s3);string s5=new string(s3,1,4);Console.WriteLine(s3=0,s3);Console.WriteLine(s4=0,s4);Console.WriteLine(s5=0,s5);Console.ReadLine();,2023/1/3,8,String,获取字符string char:索引函数string char:char ToChayArray()char ToChayArray(int int)/起始位置,复制的长度 CopyTo(int,char,int,int)/起始位置,目标数组,指定数组起始位置,复制的长度,2023/1/3,9,static void Main(string args)string s1=Microsoft!;char chs1=s1.ToCharArray();char chs2=s1.ToCharArray(5,4);Console.WriteLine(new string(chs1);Console.WriteLine(new string(chs2);char chs=new char20;Microsoft.CopyTo(0,chs,0,9);Windows2003.CopyTo(0,chs,10,7);Console.WriteLine(new string(chs);Console.ReadLine();,2023/1/3,10,字符查找,int IndexOf(char)int IndexOf(char,int)int IndexOf(char,int,int)int LastIndexOf(char,int,int)int IndexOfAny(char),static void Main(string args)string s1=沈阳师范大学软件学院;int pos=s1.IndexOf(软);Console.WriteLine(pos=0,pos);Console.ReadLine();,2023/1/3,11,public class SearchCharSample static void Main()bool bFail=true;string sName;char illChars=,#,$,%,2023/1/3,12,练习,输入一个字符串,求其中字符e出现的次数,2023/1/3,13,using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication1 class Program static void Main(string args)/string s1=miscrosoft is a big company and it is super enterprise.I study from it and want to enter;s1=Console.ReadLine();int i=0,j=0,pos=0;while(pos=0)pos=s1.IndexOf(e,j);if(pos=0)i+;j=pos+1;Console.WriteLine(i=0,i);Console.ReadLine();,2023/1/3,14,字符串填充与修剪,string PadLeft(int)string PadLeft(int char)string Trim()string Trim(char)/TrimStart(),TrimEnd(),2023/1/3,15,static void Main(string args)string s1=Microsoft,s2,s3,s4;s2=s1.PadLeft(12,);s3=s2.PadRight(14,);s4=s3.PadLeft(16,*);s4=s4.PadRight(18,*);Console.WriteLine(0,s4);Console.ReadLine();,2023/1/3,16,String,获取子串SubString查找子串IndexOf/LastIndexOfStartsWith/EndWith插入/删除子串Insert/Remove替换子串 Replace,2023/1/3,17,练习,输入一个字符串,去掉其中子串err,2023/1/3,18,static void Main(string args)/string s1=Microsoft is are a big company and the leader in it is are super man!;s1=Console.ReadLine();int pos=0;while(pos=0)pos=s1.IndexOf(are);if(pos=0)s1=s1.Substring(0,pos)+s1.Substring(pos+are.Length);Console.WriteLine(0,s1);Console.ReadLine();问题是?=Microsoft is are a big company and the leader in it is aarere super man!;,2023/1/3,19,static void Main(string args)string s1=Microsoft is are a big company and the leader in it is aarere super man!,s2;s2=;int pos=0;while(pos=0)pos=s1.IndexOf(are);if(pos=0)s2=s2+s1.Substring(0,pos);s1=s1.Substring(pos+are.Length);s2+=s1;Console.WriteLine(0,s2);Console.ReadLine();,2023/1/3,20,static void Main(string args)string s1=Microsoft is are a big company and the leader in it is aarere super man!,s2;s2=s1.Replace(are,);Console.WriteLine(0,s2);Console.ReadLine();,2023/1/3,21,Remove()Insert(),2023/1/3,22,String,格式化字符串Format解析字符串Parse/TryParseDemo,2023/1/3,23,StringBuilder,构造函数性能优化 Demo,2023/1/3,24,常用数据结构类,DateTime:日期/时间你会如何设计这个类?ArrayList:链表你会如何设计这个类?Demo,2023/1/3,25,String,编写程序,输入一个字符串,求串中包含字符串“am”的个数。,2023/1/3,26,static void Main(string args)string s1=iamamiddleschoolstudentndiamaboy!iamateacher;int j=0,k=0,i=0;while(i=0)i=s1.IndexOf(am,k);Console.WriteLine(i=0,i);if(i=0)j+;k=i+am.Length;Console.WriteLine(s1=0,j);Console.ReadLine();,2023/1/3,27,String,判断输入的字符串是否为有效身份证号码(18位,第7位开始,连续8个数字为日期即可),2023/1/3,28,class Program static void Main(string args)string s1=Console.ReadLine();if(s1.Length!=18)Console.WriteLine(无T效的?身?份证号?码?);else string s2=s1.Substring(6,8);s2=s1.Substring(6,4)+-+s1.Substring(10,2)+-+s1.Substring(12,2);try DateTime d1=DateTime.Parse(s2);Console.WriteLine(有瓺效的?身?份证号?码?);catch(Exception)Console.WriteLine(无T效的?身?份证号?码?);finally Console.ReadLine();,2023/1/3,29,常用类,Windows窗体和控件,2023/1/3,30,Windows窗体和控件,ColorSize/PointSizeF/PointF Demo,2023/1/3,31,Windows窗体和控件,Form构造函数属性方法事件 Demo,2023/1/3,32,Windows窗体和控件,Control属性方法事件,2023/1/3,33,Windows窗体和控件,2023/1/3,34,Windows窗体和控件,模态 ShowDialog非模态 Show常用事件 Load FormClosing FormClosed。,2023/1/3,35,Windows窗体和控件,private void Form1_FormClosing(object sender,FormClosingEventArgs e)MessageBox.Show(Form1_FormClosing);private void Form1_FormClosed(object sender,FormClosedEventArgs e)MessageBox.Show(Form1_FormClosed);private void Form1_Activated(object sender,EventArgs e)/MessageBox.Show(Form1_Activated);private void Form1_Deactivate(object sender,EventArgs e)/MessageBox.Show(Form1_Deactivate);private void Form1_SizeChanged(object sender,EventArgs e)MessageBox.Show(Form1_SizeChanged);private void Form1_LocationChanged(object sender,EventArgs e)MessageBox.Show(Form1_LocationChanged);,2023/1/3,36,Windows窗体和控件,按钮控件Button文本标签Label Demo,2023/1/3,37,Windows窗体和控件,输入控件TextBox/RichTextBoxCheckBox/RadioButtonComboBox/ListBox Demo,2023/1/3,38,总结,2023/1/3,39,习题,P203选择题:1,2,3,4,5,6,2023/1/3,40,The End!,

    注意事项

    本文([计算机软件及应用]高级程序设计C第八章ppt课件.ppt)为本站会员(牧羊曲112)主动上传,三一办公仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知三一办公(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    备案号:宁ICP备20000045号-2

    经营许可证:宁B2-20210002

    宁公网安备 64010402000987号

    三一办公
    收起
    展开