本文介绍了如何获得和使用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 ++)
字符串栈的数据结构法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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-18 16:45