資源簡介
可以實現+,—,*,%,mod,sin,cos,tan,EXP,m+,m-,mr,mc,x^y
十進制二進制相互轉換
換膚

代碼片段和文件信息
//?Express.cpp:?implementation?of?the?CExpress?class.
//
//////////////////////////////////////////////////////////////////////
/*?表達式計算類:??CExpress
版權聲明:該類版權屬于?南京航空航天大學?能源與動力學院?莊三少
用于其它商業用途前,請先通知作者否則視為違法。
??莊三少?TEL:13512524413??09.3.19
*/
#include?“stdafx.h“
#include?“Express.h“
#include?
#include?
#ifdef?_DEBUG
#undef?THIS_FILE
static?char?THIS_FILE[]=__FILE__;
#define?new?DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
//?Construction/Destruction
//////////////////////////////////////////////////////////////////////
CExpress::CExpress()
{
stepNum=0;
}
CExpress::~CExpress()
{
}
CString?CExpress::GetStrFromStartAndEnd(CString?strint?start?int?end)
{
CString?s;
s=““;
for?(int?i=start+1;i {
s+=str.GetAt(i);
}
return?s;
}
void?CExpress::GetBracketPos(CString?strint?*startint?*end)
{
int?pos;
pos=str.Find(“(“);
str.SetAt(pos‘d‘);
while(str.Find(“(“0)!=-1)
{
pos=str.Find(“(“0);
str.SetAt(pos‘d‘);
}
*start=pos;
pos=str.Find(“)“);
while(pos<*start)
{
pos=str.Find(“)“0);
str.SetAt(pos‘d‘);
}
*end=pos;
}
CString?CExpress::ReplaceBetweenPos(CString?toBeReplaceCString?strint?startint?end)
{
static?fg=0;
fg++;
CString?s;
toBeReplace.Delete(start+1end-start);
toBeReplace.SetAt(start‘@‘);
if?(start>0)
{
???? if?(str.GetAt(0)==‘-‘&&toBeReplace.GetAt(start-1)==‘-‘)
{
str.Delete(01);
toBeReplace.SetAt(start-1‘+‘);
}
if?(str.GetAt(0)==‘-‘&&toBeReplace.GetAt(start-1)==‘+‘)
{
str.Delete(01);
toBeReplace.SetAt(start-1‘-‘);
}
if?(str.GetAt(0)==‘+‘&&toBeReplace.GetAt(start-1)==‘-‘)
{
str.Delete(01);
toBeReplace.SetAt(start-1‘-‘);
}
if?(str.GetAt(0)==‘-‘&&toBeReplace.GetAt(start-1)==‘*‘)//problem
{
//
CString?s1s2;
int?s_ss_ep_sp_ep_m;
double?d1d2d3;
GetJJCCTwoParm(toBeReplacestart-1&s1&s2&p_s&p_e);
????????????d1=atof(s1);
if?(p_s-1>0)
{
//AfxMessageBox(“00“);
if?(toBeReplace.GetAt(p_s-1)==‘-‘)
{
toBeReplace.SetAt(p_s-1‘+‘);
}
if?(toBeReplace.GetAt(p_s-1)==‘+‘)
{
toBeReplace.SetAt(p_s-1‘-‘);
}
toBeReplace.Delete(start-11);
str.Delete(01);
???? d2=atof(str);
d3=d2*d1;
}
else
{
toBeReplace.Delete(start-11);
d2=atof(str);
d3=d2*d1;
}
s1.Format(“%f“d3);
????????????toBeReplace.Delete(p_sp_e-p_s-1);
toBeReplace.Replace(“@“s1);
return?toBeReplace;
}
//////////////////////
if?(str.GetAt(0)==‘-‘&&toBeReplace.GetAt(start-1)==‘/‘)//problem
{
//
CString?s1s2;
int?s_ss_ep_sp_ep_m;
double?d1d2d3;
GetJJCCTwoParm(toBeReplacestart-1&s1&s2&p_s&p_e);
????????????d1=atof(s1);
if?(p_s-1>0)
{
//AfxMessageBox(“00“);
if?(toBeReplace.GetAt(p_s-1)==‘-‘)
{
toBeReplace.SetAt(p_s
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????45338??2011-05-22?12:58??計算器?-?3-ultimate\Debug\Cyclops.u3
?????文件?????101550??2011-05-22?14:26??計算器?-?3-ultimate\Debug\Express.obj
?????文件??????29233??2011-05-22?12:58??計算器?-?3-ultimate\Debug\King.u3
?????文件??????29233??2011-05-22?12:58??計算器?-?3-ultimate\Debug\Media.u3
?????文件??????47005??2011-05-22?12:58??計算器?-?3-ultimate\Debug\RisingDragon.u3
?????文件?????105616??2011-05-22?12:59??計算器?-?3-ultimate\Debug\StdAfx.obj
?????文件?????334848??2011-05-22?12:58??計算器?-?3-ultimate\Debug\USkin.dll
?????文件?????361472??2011-05-23?10:48??計算器?-?3-ultimate\Debug\vc60.idb
?????文件?????405504??2011-05-22?23:07??計算器?-?3-ultimate\Debug\vc60.pdb
?????文件?????135245??2011-05-22?23:07??計算器?-?3-ultimate\Debug\計算器.exe
?????文件?????242104??2011-05-22?23:07??計算器?-?3-ultimate\Debug\計算器.ilk
?????文件??????13066??2011-05-22?12:59??計算器?-?3-ultimate\Debug\計算器.obj
?????文件????5696260??2011-05-22?12:59??計算器?-?3-ultimate\Debug\計算器.pch
?????文件?????451584??2011-05-22?23:07??計算器?-?3-ultimate\Debug\計算器.pdb
?????文件??????13696??2011-05-22?21:34??計算器?-?3-ultimate\Debug\計算器.res
?????文件??????70246??2011-05-22?23:07??計算器?-?3-ultimate\Debug\計算器Dlg.obj
?????文件??????16407??2011-05-22?14:18??計算器?-?3-ultimate\Express.cpp
?????文件???????4577??2011-05-22?14:18??計算器?-?3-ultimate\Express.h
?????文件???????3567??2011-05-22?12:58??計算器?-?3-ultimate\ReadMe.txt
?????文件????????766??2011-05-22?12:58??計算器?-?3-ultimate\res\icon1.ico
?????文件???????9662??2011-05-20?00:23??計算器?-?3-ultimate\res\mario.ico
?????文件????????398??2011-05-22?12:58??計算器?-?3-ultimate\res\計算器.rc2
?????文件???????3499??2011-05-22?12:58??計算器?-?3-ultimate\resource.h
?????文件????????208??2011-05-22?12:58??計算器?-?3-ultimate\StdAfx.cpp
?????文件???????1088??2011-05-22?12:58??計算器?-?3-ultimate\StdAfx.h
?????文件?????334848??2011-05-22?12:58??計算器?-?3-ultimate\USkin.dll
?????文件??????30195??2011-05-22?12:58??計算器?-?3-ultimate\USkin.h
?????文件??????14670??2011-05-22?12:58??計算器?-?3-ultimate\USkin.lib
?????文件???????3225??2011-05-22?20:54??計算器?-?3-ultimate\計算器.clw
?????文件???????2290??2011-05-22?12:58??計算器?-?3-ultimate\計算器.cpp
............此處省略15個文件信息
- 上一篇:統計信號處理答案
- 下一篇:計算機圖形學前沿報告flash版
評論
共有 條評論