日期:2014-05-17 浏览次数:22188 次
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace bayes01
{
public partial class Form1 : Form
{
int[] nArray = new int[6];//定义一个int型数组
public Form1()
{
InitializeComponent();
String str = textBox1.Text;
char[] ch = str.ToCharArray();//转换成char型来计算
//int[] nArray = new int[str.Length];//定义一个int型数组
const int ten = 10; //定义常量
for (int i = 0; i < ch.Length; i++)
{
nArray[i] = ch[i] - 48; //把字符转换成int
for (int j = ch.Length - i - 1; j > 0; j--)
{
nArray[i] *= ten;
}
}
}
static double cimi(double p,int m)//连续相乘
{
double sum = 1;
for(int i=0;i<m;i++)
{
sum *= p;
&