如何获得和使用C字符串评估前pressions [英] How to get and evaluate the Expressions from a string in C

查看:117
本文介绍了如何获得和使用C字符串评估前pressions的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取和评估从字符串防爆pressions C

How to get and evaluate the Expressions from a string in C

char *str = "2*8-5+6";

这应该给结果作为 17 后的评价。

This should give the result as 17 after evaluation.

推荐答案

自己尝试。您可以使用堆栈数据结构来这里评估这个字符串是参考实现(它在C ++)
<一href=\"http://cboard.cprogramming.com/cplusplus-programming/115490-can-someone-help-me-write-calculator-cplusplus-using-stack.html\"相对=nofollow>字符串栈的数据结构法calcualtion

Try by yourself. you can Use stack data structure to evaluate this string here is reference to implement (its in c++) stack data structre for string calcualtion

这篇关于如何获得和使用C字符串评估前pressions的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆