下载此文档

C#面向对象程序设计课后答案.docx


文档分类:IT计算机 | 页数:约20页 举报非法文档有奖
1/20
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/20 下载此文档
文档列表 文档介绍
****题参考答案
Chapter 1
1_1 对象 客观世界中的事物都是对象,包括有形的物理对象,可感知的逻辑实体,以及 概念化的抽象实体。它有自己的属性,能够执行特定的操作。
类 具有相同属性和操作的一组对象的集合;(按任意键退出,其它键继续•••"); while(().KeyChar!='Q')
{
"输入本金:");
double x = (()); "输入利率:");
double y = (()); "输入存款年数:");
double z = (()); 息合计为:");
for (int i=0; i<z; i++)
{ x= x + x*y;
}
(x); ,其它键继续•••"); ();
}
}
}
3-9
(1)
class Program
{
static void Main(string[] args)
{
("Please input a number:");
int n = (());
int i = 1, x = 1; while (i <= n) {
x = x * i;
i++;
}
(x); ();
}
class Program
{
static void Main()
{
("Please input a number:"); int n = (());
int i = 1, x = 1;
do
{
x = x * i;
i++;
}
while (i <= n);
(x);
();
}
}
(3)
class Program
{
static void Main()
{
("Please input a number:"); int n = (());
int x = 1;
for (int i = 1; i <= n; i++)
{
x = x * i;
}
(x);
();
}
}
3-10 略
3-11
class Program
{
static void Main()
{
(请输入一个字符串:");
(Simp(()));
}
public static string Simp(string s)
{
StringBuilder sb1 = new StringBuilder();
for (int i = 0; i < ; i++)
{
while (i < - 1 && s[i] == s[i + 1]) i++;
(s[i]);
}
return ();
3-12
(1)
class Program
{
static void Main()
{
int sum = 0;
for (int i = 1; i <= 50; i++)
{
sum += 2*i;
}
(sum);
();
}
}
(2)
class Program
{
static void Main()
{
int sum = 0, m = 1;
for (int i = 1; i <= 10; i++)
{
m = m * 2;
sum = sum + m;
}
(sum);
Console.

C#面向对象程序设计课后答案 来自淘豆网www.taodocs.com转载请标明出处.

非法内容举报中心
文档信息
  • 页数20
  • 收藏数0 收藏
  • 顶次数0
  • 上传人niupai11
  • 文件大小95 KB
  • 时间2022-05-20