代码语言
.
CSharp
.
JS
Java
Asp.Net
C
MSSQL
PHP
Css
PLSQL
Python
Shell
EBS
ASP
Perl
ObjC
VB.Net
VBS
MYSQL
GO
Delphi
AS
DB2
Domino
Rails
ActionScript
Scala
代码分类
文件
系统
字符串
数据库
网络相关
图形/GUI
多媒体
算法
游戏
Jquery
Extjs
Android
HTML5
菜单
网页交互
WinForm
控件
企业应用
安全与加密
脚本/批处理
开放平台
其它
【
C
】
计算器C语言实现
作者:
Dezai.CN
/ 发布于
2011/12/26
/
737
<div>?#include "evaluation.h"</div> #include "stack.h"</div> #include <stdio.h></div> <div>define NULL 0</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span> //运算符之间的关系</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span> // + - * / ( ) \n</div> <div>char relation[7][7] ={</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>/* + */<span class="Apple-tab-span" style="white-space:pre"> </span>{'>','>','<','<','<','>','>'},</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>/* - */<span class="Apple-tab-span" style="white-space:pre"> </span>{'>','>','<','<','<','>','>'},</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>/* * */<span class="Apple-tab-span" style="white-space:pre"> </span>{'>','>','>','>','<','>','>'},</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>/* / */<span class="Apple-tab-span" style="white-space:pre"> </span>{'>','>','>','>','<','>','>'},</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>/* ( */<span class="Apple-tab-span" style="white-space:pre"> </span>{'<','<','<','<','<','=',' '},</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>/* ) */<span class="Apple-tab-span" style="white-space:pre"> </span>{'>','>','>','>',' ','>','>'},</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>/*\n*/<span class="Apple-tab-span" style="white-space:pre"> </span>{'<','<','<','<','<',' ','='} <div><span class="Apple-tab-span" style="white-space:pre"> </span>};</div> <div>char OP[8] = {'+','-','*','/','(',')','\n'};</div> <div>void menu()</div> <div>{</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>printf("===============================\n");</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>printf(" [1]输入表达式并求值 \n");</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>printf(" [2]退出<span class="Apple-tab-span" style="white-space:pre"> </span> \n");</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>printf("===============================\n");</div> <div>} <div>char Precede(char opnd,char c)</div> <div>{</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>int i = 0;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>int j = 0;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>switch(opnd)</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>{</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '+':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>i = 0;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>switch(c)</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>{</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '+':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 0;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '-':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 1;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '*':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 2;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '/':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 3;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '(':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 4;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case ')':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 5;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '\n':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 6;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>} <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '-':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>i = 1;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>switch(c)</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>{</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '+':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 0;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '-':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 1;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '*':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 2;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '/':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 3;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '(':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 4;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case ')':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 5;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '\n':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 6;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>} <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '*':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>i = 2;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>switch(c)</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>{</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '+':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 0;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '-':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 1;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '*':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 2;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '/':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 3;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '(':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 4;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case ')':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 5;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '\n':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 6;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>} <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '/':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>i = 3;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>switch(c)</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>{</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '+':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 0;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '-':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 1;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '*':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 2;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '/':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 3;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '(':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 4;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case ')':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 5;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '\n':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 6;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>} <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '(':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>i = 4;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>switch(c)</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>{</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '+':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 0;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '-':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 1;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '*':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 2;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '/':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 3;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '(':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 4;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case ')':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 5;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '\n':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 6;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>} <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case ')':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>i = 5;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>switch(c)</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>{</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '+':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 0;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '-':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 1;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '*':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 2;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '/':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 3;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '(':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 4;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case ')':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 5;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '\n':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 6;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>} <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '\n':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>i = 6;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>switch(c)</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>{</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '+':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 0;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '-':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 1;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '*':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 2;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '/':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 3;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '(':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 4;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case ')':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 5;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '\n':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>j = 6;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return relation[i][j];</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>} <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>default :</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return NULL;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>} <div><span class="Apple-tab-span" style="white-space:pre"> </span>return NULL;</div> <div>} <div>float Operator(float first,char theta,float second)</div> <div>{</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>switch(theta)</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>{</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '+':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return first + second;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '-':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return first - second;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '*':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return first * second;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>case '/':</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return first / second;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>default:</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>break;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>} <div>} <div>BOOL In(char c,char *OP)</div> <div>{</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>int i = 0;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>while(OP[i] != '\0')</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>{</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>if(OP[i] == c)</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>{</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>return 1;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>} <div><span class="Apple-tab-span" style="white-space:pre"> </span>i++;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>} <div><span class="Apple-tab-span" style="white-space:pre"> </span>return 0;</div> <div>}
试试其它关键字
计算器
同语言下
.
获取手机通讯录 iOS去除数字以外的所有字符
.
异步加载音乐等资源
.
交通罚单管理系统
.
freemark实现,简单的替换
.
计算斐波那契数列
.
base64解码 包括解码长度
.
图像显示
.
冒泡排序
.
输入十进制数,输出指定进制
.
链式栈
可能有用的
.
C#实现的html内容截取
.
List 切割成几份 工具类
.
SQL查询 多列合并成一行用逗号隔开
.
一行一行读取txt的内容
.
C#动态修改文件夹名称(FSO实现,不移动文件)
.
c# 移动文件或文件夹
.
c#图片添加水印
.
Java PDF转换成图片并输出给前台展示
.
网站后台修改图片尺寸代码
.
处理大图片在缩略图时的展示
Dezai.CN
贡献的其它代码
(
4037
)
.
多线程Socket服务器模块
.
生成随机密码
.
清除浮动样式
.
弹出窗口居中
.
抓取url的函数
.
使用base HTTP验证
.
div模拟iframe嵌入效果
.
通过header转向的方法
.
Session操作类
.
执行sqlite输入插入操作后获得自动编号的ID
Copyright © 2004 - 2024 dezai.cn. All Rights Reserved
站长博客
粤ICP备13059550号-3