Jump to content

Typical society in the Telegram - This is the backup site feed forum.losper.net

Mass debate, problem-solving, assistance, support and a wonderful community ...

You can upload files in the Telegram channel and share link on the forum "Typical society."

This method helps to avoid broken links in the future and the loss of files on the site!

Important events on the site, you'll also find in our Telegram channel ...

Share your experiences with others, help, be responsive, friendly and communicate with other users.

Типичный Социум
Create New...
  • В данном разделе "Код и Алгоритмы", Вы можете поделится с остальными пользователями своим Кодом или разработанным, новым Алгоритмом.

    Публикуйте свой код или Алгоритм, для его обсуждения, оценки или совместной разработки и улучшения кода или алгоритма, в подходящем для этого разделе.

  • калькулятор Пишем алгоритм для калькулятора на Java

       (0 reviews)

    • Programming language: Java

    Как то так...

    import java.util.Stack;
    package calc;
    public class Calculator {
    	public static String ExpressiontoRPN(String Expr) {
    	String current = "";
    	Stack<Character> stack = new Stack<>();
    	int priority;
    	for(int i = 0; i < Expr.length(); i++) {
    		priority = getP(Expr.charAt(i));
    		if(priority == 0) current+=Expr.charAt(i);
    		if(priority == 1)stack.push(Expr.charAt(i));
    		if(priority > 1) {
    			current += ' ';
    			while(!stack.empty()) {
    				if(getP(stack.peek()) >= priority)current+=stack.pop();
    				else break;
    			if(priority == -1) {
    				current +=' ';
    				while(getP(stack.peek()) != 1)current += stack.pop();
    		return 0;
    	public static double RPNtoAnswer(String rpn){
    		return 0;
    	private static int getP(char token){
    		if(token == '*' || token == '/') return 3;
    		else if(token == '+' || token == '-') return 2;
    		else if(token == '(') return 1;
    		else if(token == ')') return -1;
    		else return 0;



    User Feedback

    There are no reviews to display.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.Privacy Policy

Search In
  • More options...
Find results that contain...
Find results in...

Write what you are looking for and press enter or click the search icon to begin your search