background image

实验 1  C#程序设计 1学时)

实验目的

了解 C#语言的特点。

熟悉 C#的开发环境。

掌握用 VS2008 编写 C#基本程序。

实验内容

1、循环实现:

2、从键盘输入一行字符串,用数组来存放统计出的字母、数字、空格和其他字符个数。

核心代码

实验一

using

 System;

using

 System.Collections.Generic;

using

 System.Linq;

using

 System.Text;

namespace

 shiyan1

{
    

class

 

Program

    {
        

static

 

void

 Main(

string

[] args)

        {
            

int

 x=2, y=1,a=0,b=0;

            

double

 s = 0, t = 1.0;

            

for

 (

int

 i = 0; i < 10; i++)

            {

2 3 5 8

s

...

10

1 2 3 5

= − + −

求前项之和