<legend id='mO8Yo'><style id='mO8Yo'><dir id='mO8Yo'><q id='mO8Yo'></q></dir></style></legend>

<small id='mO8Yo'></small><noframes id='mO8Yo'>

        <i id='mO8Yo'><tr id='mO8Yo'><dt id='mO8Yo'><q id='mO8Yo'><span id='mO8Yo'><b id='mO8Yo'><form id='mO8Yo'><ins id='mO8Yo'></ins><ul id='mO8Yo'></ul><sub id='mO8Yo'></sub></form><legend id='mO8Yo'></legend><bdo id='mO8Yo'><pre id='mO8Yo'><center id='mO8Yo'></center></pre></bdo></b><th id='mO8Yo'></th></span></q></dt></tr></i><div id='mO8Yo'><tfoot id='mO8Yo'></tfoot><dl id='mO8Yo'><fieldset id='mO8Yo'></fieldset></dl></div>
      1. <tfoot id='mO8Yo'></tfoot>
        • <bdo id='mO8Yo'></bdo><ul id='mO8Yo'></ul>
      2. 带有数学运算符的字符串到整数

        时间:2023-09-30

            <tbody id='ExAek'></tbody>
          • <bdo id='ExAek'></bdo><ul id='ExAek'></ul>

            <small id='ExAek'></small><noframes id='ExAek'>

                <tfoot id='ExAek'></tfoot>
              1. <legend id='ExAek'><style id='ExAek'><dir id='ExAek'><q id='ExAek'></q></dir></style></legend>
                  <i id='ExAek'><tr id='ExAek'><dt id='ExAek'><q id='ExAek'><span id='ExAek'><b id='ExAek'><form id='ExAek'><ins id='ExAek'></ins><ul id='ExAek'></ul><sub id='ExAek'></sub></form><legend id='ExAek'></legend><bdo id='ExAek'><pre id='ExAek'><center id='ExAek'></center></pre></bdo></b><th id='ExAek'></th></span></q></dt></tr></i><div id='ExAek'><tfoot id='ExAek'></tfoot><dl id='ExAek'><fieldset id='ExAek'></fieldset></dl></div>
                • 本文介绍了带有数学运算符的字符串到整数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我有一个带有数学运算符的字符串,我需要将其转换为 int(答案).

                  I have a string with math operators which I need to turn into an int (the answer).

                  以下代码不起作用,但我不确定如何使 answer 变量起作用.

                  The below code does not work, but I'm not sure how I can get the answer variable to work.

                  String question;
                  int answer;
                  
                  question = "7/7+9-9*5/5";
                  answer = Integer.parseInt(question);
                  

                  推荐答案

                  Integer.parseInt(question); ...要是这么简单就好了...

                  Integer.parseInt(question); ... If only it was so simple ...

                  "7/7+9-9*5/5"="nofollow">中缀表示法 您要评估并将结果打印给用户.这样做的方法是将其转换为 后缀表示法,也称为反向波兰表示法,使用 调车场算法.将表达式转换为后缀评估后,使用此算法

                  You have there a mathematical expression "7/7+9-9*5/5" in infix notation which you want to evalutate and print the result to the user. The way to do that is to convert it to postfix notation also known as Reverse Polish notation using the Shunting-yard algorithm. Once you have converted the expression to postfix evaluating is pretty easy using this algorithm

                  这篇关于带有数学运算符的字符串到整数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Java int 部门让我感到困惑 下一篇:Integer.parseInt(String str) java.lang.NumberFormatException:

                  相关文章

                  最新文章

                  <tfoot id='OplET'></tfoot>
                  <i id='OplET'><tr id='OplET'><dt id='OplET'><q id='OplET'><span id='OplET'><b id='OplET'><form id='OplET'><ins id='OplET'></ins><ul id='OplET'></ul><sub id='OplET'></sub></form><legend id='OplET'></legend><bdo id='OplET'><pre id='OplET'><center id='OplET'></center></pre></bdo></b><th id='OplET'></th></span></q></dt></tr></i><div id='OplET'><tfoot id='OplET'></tfoot><dl id='OplET'><fieldset id='OplET'></fieldset></dl></div>

                      <bdo id='OplET'></bdo><ul id='OplET'></ul>

                      <legend id='OplET'><style id='OplET'><dir id='OplET'><q id='OplET'></q></dir></style></legend>
                    1. <small id='OplET'></small><noframes id='OplET'>