廣告廣告
  加入我的最愛 設為首頁 風格修改
首頁 首尾
 手機版   訂閱   地圖  簡體 
您是第 4819 個閱讀者
 
發表文章 發表投票 回覆文章
  可列印版   加為IE收藏   收藏主題   上一主題 | 下一主題   
joe124361
數位造型
個人文章 個人相簿 個人日記 個人地圖
路人甲
級別: 路人甲 該用戶目前不上站
推文 x0 鮮花 x0
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片
推文 x0
[C#][求助] 請問一下計算機的小數點要怎樣處理
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace 小算盤
{
public enum op
{
NoAction,
ADD,
SUB,
MUL,
DIV
}

public partial class Form1 : Form
{
public op currentOp = op.NoAction;
public double currentValue = 0,lastValue = 0;
public bool needClear = false;
public StringBuilder ac = new StringBuilder();
public Form1()
{
InitializeComponent();
}

private void SetValue(string s)
{
if (needClear || textBox1.Text == "0")
{
ac.Length = 0;
ac.Append(s);
textBox1.Text = ac.ToString();
needClear = false;
}

else
{
ac.Append(s);
textBox1.Text = ac.ToString();
}
}
private void exc()
{
currentValue = double.Parse(textBox1.Text);
switch (currentOp)
{
case op.ADD:
currentValue = lastValue + currentValue;
break;
case op.SUB:
if (lastValue != 0)
{
currentValue = lastValue - currentValue;
}
break;
case op.MUL:
if (lastValue != 0)
{
currentValue = lastValue * currentValue;
}
break;
case op.DIV:
if (lastValue != 0 && currentValue != 0)
{
currentValue = (lastVal ..

訪客只能看到部份內容,免費 加入會員 或由臉書 Google 可以看到全部內容




獻花 x0 回到頂端 [樓 主] From:臺灣中華HiNet | Posted:2008-01-18 17:27 |

首頁  發表文章 發表投票 回覆文章
Powered by PHPWind v1.3.6
Copyright © 2003-04 PHPWind
Processed in 0.012534 second(s),query:15 Gzip disabled
本站由 瀛睿律師事務所 擔任常年法律顧問 | 免責聲明 | 本網站已依台灣網站內容分級規定處理 | 連絡我們 | 訪客留言