-
大小: 6KB文件類型: .rar金幣: 2下載: 0 次發(fā)布日期: 2023-12-19
- 語(yǔ)言: 其他
- 標(biāo)簽: 浮點(diǎn)數(shù)??DFA??
資源簡(jiǎn)介
編寫(xiě)程序利用DFA的原理實(shí)現(xiàn)高級(jí)語(yǔ)言中浮點(diǎn)數(shù)的識(shí)別算法

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Text;
using?System.Windows.Forms;
using?System.Diagnostics;
namespace?浮點(diǎn)數(shù)的DFA
{
????public?partial?class?Form1?:?Form
????{
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????/******************狀態(tài)函數(shù)******************/
????????private?int?zt0(char?c)
????????{
????????????if?(c?==?‘+‘?||?c?==?‘-‘)
????????????{
????????????????listBox_xs.Items.Add(“狀態(tài)0→1?(條件‘+/-‘)“);
????????????????return?1;
????????????}
????????????else?if?(c?==?‘.‘)
????????????{
????????????????listBox_xs.Items.Add(“狀態(tài)0→3?(條件‘.‘)“);
????????????????return?3;
????????????}
????????????else?if?(c?>=?‘0‘?&&?c?<=?‘9‘)
????????????{
????????????????listBox_xs.Items.Add(“狀態(tài)0→2?(條件數(shù)字‘“+c+“‘)“);
????????????????return?2;
????????????}
??????????????else??return?9;?//9-錯(cuò)誤狀態(tài)
????????}
????????private?int?zt1(char?c)
????????{
????????????if?(c?>=?‘0‘?&&?c?<=?‘9‘)
????????????{
????????????????listBox_xs.Items.Add(“狀態(tài)1→2?(條件數(shù)字‘“?+?c?+?“‘)“);
????????????????return?2;
????????????}
??????????????else??return?9;
????????}
????????private?int?zt2(char?c)
????????{
????????????if?(c?>=?‘0‘?&&?c?<=?‘9‘)
????????????{
????????????????listBox_xs.Items.Add(“狀態(tài)2→2?(條件數(shù)字‘“?+?c?+?“‘)“);
????????????????return?2;
????????????}
????????????if?(c?==?‘.‘)
????????????{
????????????????listBox_xs.Items.Add(“狀態(tài)2→3?(條件‘.‘)“);
????????????????return?3;
????????????}
????????????if?(c?==?‘e‘?||?c?==?‘E‘)
????????????{
????????????????listBox_xs.Items.Add(“狀態(tài)2→5?(條件‘e/E‘)“);
????????????????return?5;
????????????}
??????????????else??return?9;
?
????????}
????????private?int?zt3(char?c)
????????{
????????????if?(c?>=?‘0‘?&&?c?<=?‘9‘)
????????????{
????????????????listBox_xs.Items.Add(“狀態(tài)3→4?(條件數(shù)字‘“?+?c?+?“‘)“);
????????????????return?4;
????????????}
?????????????else??return?9;
????????}
????????private?int?zt4(char?c)
????????{
????????????if?(c?>=?‘0‘?&&?c?<=?‘9‘)
????????????{
????????????????listBox_xs.Items.Add(“狀態(tài)4→4?(條件數(shù)字‘“?+?c?+?“‘)“);
????????????????return?4;
????????????}
????????????if?(c?==?‘e‘?||?c?==?‘E‘)
????????????{
????????????????listBox_xs.Items.Add(“狀態(tài)4→5?(條件‘e/E‘)“);
????????????????return?5;
????????????}
????????????else??return?9;
????????}
????????private?int?zt5(char?c)
????????{
????????????if?(c?==?‘+‘?||?c?==?‘-‘)
????????????{
????????????????listBox_xs.Items.Add(“狀態(tài)5→6?(條件‘+/-‘)“);
????????????????return?6;
????????????}
????????????if?(c?>=?‘0‘?&&?c?<=?‘9‘)
????????????{
????????????????listBox_xs.Items.Add(“狀態(tài)5→7?(條件數(shù)字‘“?+?c?+?“‘)“);
????????????????return?7;
????????????}
????????????else?return?9;
????????}
????????private?int?zt6(char?c)
????????{
????????????if?(c?>=?‘0‘?&&?c?<=?‘9‘)
????????????{
????????????????listBox_xs.Items.Add(“狀態(tài)6→7?(條件數(shù)字‘“?+?c?+?“‘)“);
????????????????return?7;
????????
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件???????5273??2008-10-27?10:13??Form1.cs
?????文件??????24576??2008-10-27?10:13??浮點(diǎn)數(shù)的DFA.exe
-----------?---------??----------?-----??----
????????????????29849????????????????????2
評(píng)論
共有 條評(píng)論