C++ input value process as math function [closed] - c++

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I’m very new in C++ and I need your help. I want to use the input value as a mathematical function then print the result.
What i need is:
When user input: 2 +1 and hit Enter then output (cout>>)
should be your result is: 3 (the sum of 2 + 1)
The mathematical symbol could be + or * or / or -.
Could you please help me with some example?
Thanks in advance!

Search for "Reverse Polish notation" and implementation in C++

Related

writing c++ program "fraction of double" [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I wanna write a c++ program that read a double value and after reading it print only the fraction of that number, for example if the input was 14.25 then the output must be 0.25
should include iomanip to it?
One approach would be to
Round the number down to the nearest integer - you can use the floor() function (http://www.cplusplus.com/reference/cmath/floor/)
Subtract that integer from the original number to get the result

Regex expression to replace string with * [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I need to convert string like this to
ABC_464_aDE.hmi_2df
to ABC464aDE.* that is want to remove all _ and add * at the end after dot. And my project requirement is to do this using regex. Please help to sort this out.
Thanks
If you are using C# the you can use this code
txt=Regex.Replace(txt.Replace("_",""), #"\.\w+", "");

Turning a string that contains a equation into an integer [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I would like to be able to convert a string such as "(5+6)*6" and get the resulting integer from that equation. It is important that it starts out as a string.
You can use library fastmathparser for c++.
In link is example how use this library.
If you really want write alone this parser, I recomended use Shunting-yard algorithm

displaying sequence of numbers [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am trying to understand the pattern of these sequence of numbers and write c++ code using one of loop structures.the numbers are:
1, 2, 5, 14, 41, ...
I want the code to display these numbers.Can somebody help me with this?Thank you in advance.
You can search for such sequences on your favorite web search engine and you'll usually end up on OEIS.org. In this case, here: https://oeis.org/A007051
Your equation is (3^n + 1)/2.

different between CRC8 , CRC16 and CRC32? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I would like to know the difference and how to choose the polynomial generator for different crc ?
And in some C code they have look up table to compute crc and some of them do it by xor truth table. but in both the cases it is 1byte data array. Its confusing . Could somebody explain this as well ?
Thanks.!