Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % hello world program
- -module(helloworld).
- -export([start/0]).
- -export([odwrocenieDzialania/1]).
- -export([wczytajCiagDoListy/1]).
- -import(lists,[reverse/1]).
- start() ->
- %wczytanie ciągu
- Ciag=wczytajCiagDoListy("a + b"),
- %odwrócenie kolejności w ciągu
- OdwroconyCiag=odwrocenieDzialania(Ciag),
- io:fwrite("~p~n",[OdwroconyCiag]),
- %utworzenie listy operatorów + - * /
- Operatory=['+','-','*','/']
- %pobranie Elementu z listy i sprawdzenie czy jest Operatorem
- %Jeśli jest operatorem to dodaj na Stos, jeżeli nie dodaj
- %do ciągu wyjściowego
- .
- wczytajCiagDoListy(Ciag)->
- Lista=string:tokens(Ciag, " "),
- Lista.
- odwrocenieDzialania(L) ->
- reverse(L).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement