()+26<()+71半括号代表表同一个数对吗

题目18:用C语言设计一个简单的计算器,要求能够对输入的数 1.进行+,-,*,/,运算; 2.可以带括号( ); _百度知道
题目18:用C语言设计一个简单的计算器,要求能够对输入的数 1.进行+,-,*,/,运算; 2.可以带括号( );
要正确的答案,错的别来
#include&stdio.h& #include&string.h& #include&stdlib.h& int deal(int op1,int op2,char op) //运算 { switch(op) { case '+': op1 += op2; case '-': op1 -= op2; case '*': op1 *= op2; case '/': op1 /= op2; break缉福光凰叱好癸瞳含困; case '^': { int temp = op2; for(int i = 1; i & op2 - 1; i++) op1 *=
} } return op1; } char *replace(char *source, char *sub, char *rep) //字符串替换 { char * char *pc1, *pc2, *pc3; int isource, isub, isub = strlen(sub); irep = strlen(rep); isource = strlen(source); if(NULL == *sub) return strdup(source); result = (char *)malloc(( (irep & isub) ? (float)strlen(source) / isub* irep+ 1:isource ) * sizeof(char)); pc1 = while(*source != NULL) { pc2 = pc3 = while(*pc2 == *pc3 && *pc3 != NULL && *pc2 != NULL) pc2++, pc3++; if(NULL == *pc3) { pc3 = while(*pc3 != NULL) *pc1++ = *pc3++; pc2--; source = pc2; } else *pc1++ = * source++; } *pc1 = NULL;
} int main() { char s[1000],op1[100],op2[100],*p,*temp,* scanf(&%s&,&s); temp = back = int pos = -1; int fin,oper1,oper2,tmp,
while(1) { size = (int)strlen(temp); for(int i = 0; i & i++,temp++) { if( *temp == '(') { p = (temp + 1); pos =(i + 1); //找出最后一个(的位置 } } int k = 0; if(pos != -1) { temp = tmp = while(*p != ')') { p++; tmp++; if( *p == '*' || *p == '/') { tmp--; for(;(temp[tmp] &= '0' && temp[tmp] &= '9') || temp[tmp] == '.';) { tmp--;
} if(tmp != pos && *p != ')') { pos = ++ } int start = while( temp[pos] &= '0' && temp[pos] &= '9') { op1[k] = temp[pos]; pos++; k++; } op1[k] = '\0'; while((temp[pos] &= '0' && temp[pos] &= '9') || temp[pos] == '.') pos++; op = temp[pos]; oper1 = atoi(op1); pos++; k = 0; while( temp[pos] &= '0' && temp[pos] &= '9') { op2[k] = temp[pos]; pos++; k++; } op2[k] = '\0'; while((temp[pos] &= '0' && temp[pos] &= '9') || temp[pos] == '.') pos++; oper2 = atoi(op2);
if( temp[pos] != ')') end = -- else { if(temp[start-1] == '(') { end = start--; } } char rep[100]; k = 0; for(; start &= start++,k++) { rep[k] = temp[start]; } rep[k] = '\0'; fin = deal(oper1,oper2,op); char final[100]; itoa(fin,final,10); temp = replace(temp,rep,final); back = pos = -1; p = k = 0; *rep = NULL; *final = NULL; printf(&%s\n&,replace(temp,rep,final)); } else { temp = p = tmp = while(*p != '\0') { p++; tmp++; if( *p == '*' || *p == '/') { tmp--; for(;(temp[tmp] &= '0' && temp[tmp] &= '9') || temp[tmp] == '.';) { tmp--;
} if(tmp != pos && tmp != (int)strlen(temp)-1) { pos = ++ } else pos = 0; int start = while( temp[pos] &= '0' && temp[pos] &= '9') { op1[k] = temp[pos]; pos++; k++; } while((temp[pos] &= '0' && temp[pos] &= '9') || temp[pos] == '.') pos++; op1[k] = '\0'; op = temp[pos]; oper1 = atoi(op1); pos++; k = 0; while( temp[pos] &= '0' && temp[pos] &= '9') { op2[k] = temp[pos]; pos++; k++; } op2[k] = '\0'; while((temp[pos] &= '0' && temp[pos] &= '9') || temp[pos] == '.') { pos++; if(pos &= (int)strlen(temp))
} oper2 = atoi(op2); int end = -- char rep[100] = {'\0'}; k = 0; for(; start &= start++) { rep[k] = temp[start]; k++; } fin = deal(oper1,oper2,op); char final[100]; itoa(fin,final,10); temp = replace(temp,rep,final); back = for(k = 0; k & (int)strlen(temp); k++) { if(temp[k] & '0' || temp[k] & '9' && temp[k] != '.')
} if(k == (int)strlen(temp))
pos = -1; p = k = 0; printf(&%s\n&, temp); } } printf(&%d\n&,fin); return 0; }
其他类似问题
为您推荐:
其他1条回答
#include &stdio.h&int m缉福光凰叱好癸瞳含困ain(){ int a,b; scanf(&%d%c%d&,&a,&op,&b); switch(op) {
case'+':
printf(&%d+%d=%d\n&,a,b,a+b);
case'-':
printf(&%d-%d=%d\n&,a,b,a-b);
case'*':
printf(&%d*%d=%d\n&,a,b,a*b);
case'/':
printf(&Division by zero!\n&);
printf(&%d/%d=%d\n&,a,b,a/b);
} } return 0;}
c语言的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁在1/( )+1/18=1/( )的括号内填入一个数,使得等式成立,且要求所填的两个分母与18的最大公因数为1_百度知道
在1/( )+1/18=1/( )的括号内填入一个数,使得等式成立,且要求所填的两个分母与18的最大公因数为1
提问者采纳
18=1&#47:在正整数范围内;18=1&#47、1&#47、18、18、14的最大公因数为12,有两种情形;(7)306;(63)+1/(306)+1&#47:1;(14)63、1&#47解、7的最大公因数为1供参考
其他类似问题
为您推荐:
其他2条回答
ab=18k;18=1&#47,即1/ab=1/b==1&#47:1/[(√73-1)&#47,得a=[√73-1]/a-1/2k=3时,无法取到你要求的两个整数;2;18,∴b-a=k;9+1/18,b=9;2
b=[√73+1]&#47,a=6;[(√73+1)/6;2
b=[√(k^2+72k)+k]&#47,得(b-a)&#47,解得a=[√(k^2+72k)-k]&#47,有;18=1&#47。令k=1;2】+1&#47令1&#47
简单运算得到 1/18=1/a-1/b,变成了将单位分数1/18拆成两个单位分数之差的形式。因为18=1x18=2x9=3x6,故 1/18=1x(18-1)/(18x17)=1/17-1/(18x17)=1/17-1/306,1/18=1x(9-2)/(18x7)=1/14-1/63;
1/18=1x(6-3)/(18x3)=1/9-1/18其中 (17,306,18)=1,(14,63,18)=1,(9,18,18)=9满足条件的有两个:1/17-1/306,
最大公因数的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁如何使()*()=4+()这个等式成立,且括号内是同一个数字_百度知道
如何使()*()=4+()这个等式成立,且括号内是同一个数字
2或-2列方程可得x^2=4+x解之得x1=2,x2=-2求一算法。( )+( )=( )
( )-( )=( )
( )*( )=( )0
要求一个括号只填一个数字,将1--9填入括号,不能重复使用
[问题点数:100分,结帖人xzq686]
求一算法。( )+( )=( )
( )-( )=( )
( )*( )=( )0
要求一个括号只填一个数字,将1--9填入括号,不能重复使用
[问题点数:100分,结帖人xzq686]
不显示删除回复
显示所有回复
显示星级回复
显示得分回复
只显示楼主
相关帖子推荐:
2006年4月 专题开发/技术/项目大版内专家分月排行榜第二2005年11月 专题开发/技术/项目大版内专家分月排行榜第二2005年10月 专题开发/技术/项目大版内专家分月排行榜第二2005年8月 专题开发/技术/项目大版内专家分月排行榜第二2005年4月 专题开发/技术/项目大版内专家分月排行榜第二2005年3月 专题开发/技术/项目大版内专家分月排行榜第二2005年2月 专题开发/技术/项目大版内专家分月排行榜第二2005年1月 专题开发/技术/项目大版内专家分月排行榜第二2003年6月 专题开发/技术/项目大版内专家分月排行榜第二
2005年7月 专题开发/技术/项目大版内专家分月排行榜第三2004年11月 专题开发/技术/项目大版内专家分月排行榜第三2003年4月 专题开发/技术/项目大版内专家分月排行榜第三
本帖子已过去太久远了,不再提供回复功能。“我会算” 71-9=()-6=()-30=()-8=()问括号里应填入什么数字._作业帮
拍照搜题,秒出答案
“我会算” 71-9=()-6=()-30=()-8=()问括号里应填入什么数字.
“我会算” 71-9=()-6=()-30=()-8=()问括号里应填入什么数字.
71-9=(68)-6=(32)-30=(70)-8=(62)这种题要先算出71-9等于多少,在根据得数算中间的.
71-9=(62)-6=(56)-30=(36)-8=(28)
71-9=(62)-6=(56)-30=(36)-8=(28)
第三个70 第四个 62
62 56 36 28
18楼上是错的
71-9=(68)-6=(92)-30=(70)-8=(62) 这里是考孩子71-9的结果,然后再计算谁减去6也得62,依次类推。
71-9=62-6=56-30=26-8=18
71-9=68-6=92-30=70-8
71-9=62-6=58-30=28-8=20
71-9=()-6=()-30=()-8=()方法:先写最后一个差是62
然后根据:差加减数=任何一个被减数
71-9=62-6=52-30=22-8=14
71-9=(62)-6=(56)-30=(36)-8=(28)
)-6=()-30=()-8=()71-9=(62)-6=(56)-30=(36)-8=(28)
71-9=(62)-6=(56)-30=(36)-8=(28)
71-9=(68)-6=(92)-30=(70)-8=(62)
71-9=(62)-6=(56)-30=(36)-8=(28)

我要回帖

更多关于 索尼lt26ii强刷 的文章

 

随机推荐