91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 294KB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2021-06-18
  • 語言: 其他
  • 標簽: zip??

資源簡介

利用棧求表達式的值,可供小學生作業,并能給出分數

資源截圖

代碼片段和文件信息

#include??
#include???
#include?
#include???
#define?STACK_INIT_SIZE?100?
#define?STACKINCREMENT?10?
#define?ERROR?0?
#define?OK?1?
//定義表達式??
typedef?struct?shiti
{??????
char?a[20];?????
long?result;?
}xuanti;???
typedef?struct?SqStack1?
{?//建立數字棧?
int?*base;?????
int?*top;?????
int?stacksize;?
}SqStack1;?????????????????
typedef?struct?SqStack2?
{
//建立運算符棧?
char?*base;?????
char?*top;?????
int?stacksize;?
}SqStack2;
void?WriteToFile(xuanti?*pstuint?num);?
void?ReadFromFile(xuanti?*pstuint?num);???
void?page_title(char?*menu_item)?
{//建立菜單???????
printf(“>>>?數學習題庫?<<<\n\n-?%s?-\n\n“menu_item);?
}??
void?return_confirm()
{???????
printf(“\n按任意鍵返回……\n“);
getch();?
}???
void?IntInitStack(SqStack1?*S1)?
{?
S1->base=(int?*)malloc(STACK_INIT_SIZE*sizeof(int));???
if(!S1->base)?
exit(ERROR);
S1->top=S1->base;
S1->stacksize=STACK_INIT_SIZE;
}//IntInitStack???
void?CharInitStack(SqStack2?*S2)?
{
S2->base=(char?*)malloc(STACK_INIT_SIZE*sizeof(char));????
if(!S2->base)?
exit(ERROR);??
S2->top=S2->base;?
S2->stacksize=STACK_INIT_SIZE;?
}//CharInitStack?
long?IntGetTop(SqStack1?*S1)????????????
{?//取棧頂元素?????
long?e1;??????
if((*S1).top==(*S1).base)?????
return?0;??????
e1=*((*S1).top-1);
return?e1;
}//IntGetTop
char?CharGetTop(SqStack2?*S2)????????????
{?//取棧頂元素?????
char?e2;??????
if((*S2).top==(*S2).base)?
return?0;?????
e2=*((*S2).top-1);?????
return?e2;?
}//IntGetTop???
int?IntPush(SqStack1?*S1int?e1)?
{//入棧??????
*(*S1).top++=e1;?????
return?OK;?
}//IntPush???
int?CharPush(SqStack2?*S2char?e2)?
{//入棧??????
*(*S2).top++=e2;?????
return?OK;?
}//CharPush???
int?IntPop(SqStack1?*S1)?
{//出棧?????
int?e1;??????
if((*S1).top==(*S1).base)????
return?0;??????
e1=*--(*S1).top;
????return?e1;?
}//IntPop???
int?CharPop(SqStack2?*S2)?
{//出棧????
char?e2;?
if((*S2).top==(*S2).base)
return?0;??
e2=*--(*S2).top;?
return?e2;?
}//CharPop???????????????
char?Precede(char?achar?b)
{
int?ij;???
char?Table[8][8]={?‘?‘‘+‘‘-‘‘*‘‘/‘‘(‘‘)‘‘#‘????????????????????????
‘+‘‘>‘‘>‘‘<‘‘<‘‘<‘‘>‘‘>‘????????????????????????
‘-‘‘>‘‘>‘‘<‘‘<‘‘<‘‘>‘‘>‘????????????????????????
‘*‘‘>‘‘>‘‘>‘‘>‘‘<‘‘>‘‘>‘????????????????????????
‘/‘‘>‘‘>‘‘>‘‘>‘‘<‘‘>‘‘>‘????????????????????????
‘(‘‘<‘‘<‘‘<‘‘<‘‘<‘‘=‘‘?‘????????????
‘)‘‘>‘‘>‘‘>‘‘>‘‘?‘‘>‘‘>‘?????
‘#‘‘<‘‘<‘‘<‘‘<‘‘<‘‘?‘‘=‘?};???????????
//優先級表格?????
for(i=0;i<8;i++)???
if(Table[0][i]==a)?? //縱坐標尋找?????
break;?
for(j=0;j<8;j++)???????????//橫坐標尋找?????
if(Table[j][0]==b)?
break;?
return?Table[j][i];?
}//Precede???
int?Operate(int?achar?thetaint?b)??????????
{?//計算表達式值:主要是將大的表達式轉化成小的表達式進行逐步求值
int?c;
if(theta==‘+‘)?c=a+b;?
else?if(theta==‘-‘)?c=a-b;??
else?if(theta==‘*‘)?c=a*b;?????
else?c=a/b;?
????return?c;
?}//Operate?
int?IsOptr(char?c

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2017-07-04?16:07??數據結構課設\
?????文件???????10463??2017-07-04?16:03??數據結構課設\Cpp1.cpp
?????文件????????3377??2017-07-04?15:19??數據結構課設\Cpp1.dsp
?????文件?????????516??2017-07-04?16:07??數據結構課設\Cpp1.dsw
?????文件???????41984??2017-07-04?16:07??數據結構課設\Cpp1.ncb
?????文件???????48640??2017-07-04?16:07??數據結構課設\Cpp1.opt
?????文件????????2730??2017-07-04?16:05??數據結構課設\Cpp1.plg
?????目錄???????????0??2017-07-04?16:03??數據結構課設\Debug\
?????文件??????217135??2017-07-04?15:52??數據結構課設\Debug\Cpp1.exe
?????文件??????278948??2017-07-04?15:52??數據結構課設\Debug\Cpp1.ilk
?????文件??????223132??2017-07-04?16:03??數據結構課設\Debug\Cpp1.pch
?????文件??????582656??2017-07-04?15:52??數據結構課設\Debug\Cpp1.pdb
?????文件???????33792??2017-07-04?16:05??數據結構課設\Debug\vc60.idb
?????文件???????53248??2017-07-04?16:05??數據結構課設\Debug\vc60.pdb
?????文件???????????2??2017-07-04?16:03??數據結構課設\markrec.txt
?????文件???????????4??2017-07-04?15:55??數據結構課設\n_rec.txt
?????文件???????????0??2017-07-04?16:03??數據結構課設\shitiku.txt

評論

共有 條評論