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 7 years ago.
Improve this question
I have a task in my school extraculicular. my task is to create a calculator that can run with 1 input. example,
input:
3+7+1*2
and the output will be
12
like that, how to create that? i have search in google to create calculator but all of them show basic tutorial like "Input first number:" "Input second number" "What operator u want" "Result"
Thank's before.
My english is not well.
That is very easy in Free Pascal:
uses symbolic;
var s : string;
begin
s:='3+7+1*2';
//readln(s)
writeln(round(quickevaluate(s,[],[])));
end.
prints
12
You can read the input expression from the user with readln(s) instead of the fixed expression.
The round is because the evaluation returns a single, for more details see the sources of unit symbolic.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
add=+
echo "$((1{$add}2))"
If I write 1+2 it outputs 3, but when I store the + sign in a variable called "add" and then use it in place of + operator, it just outputs it as if it was a string. How can I use the variable and still make it output 3?
As far as I can see, the code is wrong and should not print anything but an error.
What you should do is write the variable as ${add}, not {$add}.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I want to define a new variable called : character , with type of character
How can i do that without errors? (despite they have the same name)
I tried this on paper : variable character: character, but i am not sure if its correct or not
Thanks.
It depends on your programming language. Like in java you use-
char character = 'A';
And in c-
char character;
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
東京都building千代田区丸の内1building2floor1number
to
東京都千代田区丸の内1-2-1
PS: Digits are double bytes.I have a string,that contains address. How to convert that address like above.
Answering the question that probably should have been asked (given the clarifications in comments):
address.gsub(/([0-9]+)(?:丁目|番地?|号)(?=[0-9]|$)/, '\1-').sub(/-$/, '')
This will process any sequences of "number+location" (with "location" being lot, block, (house) number...) that is either followed by another number, or is at the end of the string, replacing the location with a dash; then removing the final dash, if there is one.
Note that this will not pick up on Japanese numbers: if you get an address like 東京都千代田区丸の内一丁目2番1号, it makes no sense to transform it to 東京都千代田区丸の内一-2-1, and converting Japanese numbers into Arabic ones is trivial up to 9 and then a bit less trivial.
string.gsub(/(?<=[0-9])(?:丁目|番地?|号)\b/, "-").sub(/\z/, "")
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I want to verify the numbers after a given decimal. Values above 10 should be considered as invalid. I would need a regex command to verify. For example:
Input: Expected response
0.005: valid
1.003: not valid
1.04: valid
I tried the following regex, but it doesn't give me the expected result.
/\d{0,1}\d{0,3}/
If I understand your question correctly
^(0\.\d{3}|[1-9]\.\d{2}|10\.00)$
online test
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I want to be able to input a number and choose a variable then what the variable is set to then its subtracted by the number inputed and displayed in a TextBox when i click the calculate button (I'm trying to create a rank calculator for a game).
[Current cR is TextBox1, Choosen Rank is ComboBox1 and Calculate is Button1]
The Template
http://imgur.com/ofre43a
It will look something like this if I understand your equation correctly.
private1-textbox1.value/agxp = rgr
I think that is essentially what you are asking. I am assuming you will have assigned a value to private1 previously and that the ccr is inputed by the user. I also am assuming that your agxp is also previously assigned. There is the possibility that the value in textbox1 will be read as a string not as an integer. If that is the case, you will have to convert it to an integer.