https://www.doczj.com/doc/708765752.html,购物车实验报告
篇一:ASPNET实验报告
实验1 C#程序设计1(2学时)
[实验目的]
了解C#语言的特点。
熟悉C#的开发环境。
掌握用VSXX编写C#基本程序。
[实验内容]
1、循环实现:
2、从键盘输入一行字符串,用数组来存放统计出的字母、数字、空格和其他字符个数。题一
using System;
using ;
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 {
a = x ;
b = y;
s +=t* a / b;
x = a + b;
y = a;
t = -1.0 * t;
}
Console.WriteLine("s="+s);
Console.ReadKey();
}
}
}
题二
public static void Main() {
int letters = 0, digits = 0, spaces = 0, others = 0;
Console.WriteLine("请输入一个字符串: ");
string input = Console.ReadLine();
foreach(char chr in input)
{ if (char.IsLetter(chr)) letters++;