网站大量收购独家精品文档,联系QQ:2885784924

C#程序设计及基于工作过程的项目开发(高职)(谢世煊) 第2章.ppt

C#程序设计及基于工作过程的项目开发(高职)(谢世煊) 第2章.ppt

  1. 1、本文档共85页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
  2.1 任务一:学会使用已有资源 2.1.1 功能描述   本任务通过一个控制台应用程序,演示了C#.NET框架类中的几个常用的类,包括System.String、System.StringBuilder、System.Math和System.Random类。 2.1.2 代码展示   1 using System;   2 using System.Text;   3 namespace useClassPro   4 {   5 class Program   6 {   7 static void Main(string[] args)   8 {   9 StringBuilder former = new StringBuilder(原始字符串为: );   10 StringBuilder total;   11 string mutation1, mutation2, mutation3;   12 int a, b, c;   13 double discriminant, root1, root2, test;   14 Console.WriteLine(原始字符串为: \ + former + \);   15 Console.WriteLine(字符串长度为: + former.Length);   16 total = former.Append(ax^2+bx+c);   17 mutation1 = total.ToString().ToUpper();   18 mutation2 = mutation1.Replace(X, y);   19 mutation3 = mutation2.Substring(21,9);   20 Console.WriteLine(连接后的字符串为: + total);   21 Console.WriteLine(mutation1 -- 调用大写函数后: + mutation1);   22 Console.WriteLine(mutation2 -- 调用替代函数将X替代为y后: +mutation2);   23 Console.WriteLine(mutation3 -- mutation2的子串: + mutation3);   24 Console.WriteLine();   25 Console.WriteLine(请输入x^2的参数A:);   26 a = int.Parse(Console.ReadLine());   27 Console.Write(请输入x的参数B:);   28 b = int.Parse(Console.ReadLine());   29 Console.WriteLine(请输入方程的常数C:);   30 c = int.Parse(Console.ReadLine());   31 discriminant = Math.Pow(b, 2) - (4 * a * c);   32 root1 = ((-1 * b) + Math.Sqrt(discriminant)) / (2 * a);   33 root2 = ((-1 * b) - Math.Sqrt(discriminant)) / (2 * a);      34 Console.WriteLine(Root1: + root1);   35 Console.WriteLine(Root2: + root2);   36 Console.WriteLine();      37 Console.WriteLine(让我们尝试随机生成方程:);   38 System.Random gener

文档评论(0)

开心农场 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档