<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.universitas.ro/index.php?action=history&amp;feed=atom&amp;title=3536_-_EvaluareExpresie</id>
	<title>3536 - EvaluareExpresie - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.universitas.ro/index.php?action=history&amp;feed=atom&amp;title=3536_-_EvaluareExpresie"/>
	<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=3536_-_EvaluareExpresie&amp;action=history"/>
	<updated>2026-05-01T07:26:52Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://wiki.universitas.ro/index.php?title=3536_-_EvaluareExpresie&amp;diff=9633&amp;oldid=prev</id>
		<title>Aurelia Raluca at 09:11, 13 February 2024</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=3536_-_EvaluareExpresie&amp;diff=9633&amp;oldid=prev"/>
		<updated>2024-02-13T09:11:26Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;a href=&quot;//wiki.universitas.ro/index.php?title=3536_-_EvaluareExpresie&amp;amp;diff=9633&amp;amp;oldid=9262&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>Aurelia Raluca</name></author>
	</entry>
	<entry>
		<id>https://wiki.universitas.ro/index.php?title=3536_-_EvaluareExpresie&amp;diff=9262&amp;oldid=prev</id>
		<title>Aurelia Raluca: /* Rezolvare */</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=3536_-_EvaluareExpresie&amp;diff=9262&amp;oldid=prev"/>
		<updated>2024-01-08T21:35:23Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Rezolvare&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;a href=&quot;//wiki.universitas.ro/index.php?title=3536_-_EvaluareExpresie&amp;amp;diff=9262&amp;amp;oldid=9261&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>Aurelia Raluca</name></author>
	</entry>
	<entry>
		<id>https://wiki.universitas.ro/index.php?title=3536_-_EvaluareExpresie&amp;diff=9261&amp;oldid=prev</id>
		<title>Aurelia Raluca: /* Exemplul 2 */</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=3536_-_EvaluareExpresie&amp;diff=9261&amp;oldid=prev"/>
		<updated>2024-01-08T21:33:48Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Exemplul 2&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 21:33, 8 January 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l41&quot;&gt;Line 41:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 41:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;; intrare&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;; intrare&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;:&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;89 &lt;/del&gt;1 2 1 ^ * -&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;:&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;-77 &lt;/ins&gt;1 2 1 ^ * -&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;:&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;62&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;:&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;6&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;; iesire  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;; iesire  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Aurelia Raluca</name></author>
	</entry>
	<entry>
		<id>https://wiki.universitas.ro/index.php?title=3536_-_EvaluareExpresie&amp;diff=8123&amp;oldid=prev</id>
		<title>Aurelia Raluca: /* Rezolvare */</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=3536_-_EvaluareExpresie&amp;diff=8123&amp;oldid=prev"/>
		<updated>2023-12-14T15:09:46Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Rezolvare&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 15:09, 14 December 2023&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l53&quot;&gt;Line 53:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 53:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;line=&amp;quot;1&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;line=&amp;quot;1&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#3536 - EvaluareExpresie&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#3536 - EvaluareExpresie&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;#include &amp;lt;iostream&amp;gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;#include &amp;lt;stack&amp;gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;#include &amp;lt;cmath&amp;gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;using namespace std;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;int prioritate(char op) {&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;int prioritate(char op) {&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Aurelia Raluca</name></author>
	</entry>
	<entry>
		<id>https://wiki.universitas.ro/index.php?title=3536_-_EvaluareExpresie&amp;diff=8121&amp;oldid=prev</id>
		<title>Aurelia Raluca: Pagină nouă: == Cerinta ==   Se consideră o expresie aritmetică formată din numere naturale și operatorii binari + (adunare), - (scădere), * (înmulțire), ^ (ridicare la putere). Să se determine forma postfixată corespunzătoare și să se calculeze valoarea expresiei. Spunem că expresia este în formă infixată dacă fiecare operator binar este încadrat de cei doi operanzi ai săi. Aceasta este de fapt forma uzuală a expresiilor aritmetice. Spunem că expresia este în formă...</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=3536_-_EvaluareExpresie&amp;diff=8121&amp;oldid=prev"/>
		<updated>2023-12-14T15:06:39Z</updated>

		<summary type="html">&lt;p&gt;Pagină nouă: == Cerinta ==   Se consideră o expresie aritmetică formată din numere naturale și operatorii binari + (adunare), - (scădere), * (înmulțire), ^ (ridicare la putere). Să se determine forma postfixată corespunzătoare și să se calculeze valoarea expresiei. Spunem că expresia este în formă infixată dacă fiecare operator binar este încadrat de cei doi operanzi ai săi. Aceasta este de fapt forma uzuală a expresiilor aritmetice. Spunem că expresia este în formă...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Cerinta == &lt;br /&gt;
&lt;br /&gt;
Se consideră o expresie aritmetică formată din numere naturale și operatorii binari + (adunare), - (scădere), * (înmulțire), ^ (ridicare la putere). Să se determine forma postfixată corespunzătoare și să se calculeze valoarea expresiei.&lt;br /&gt;
Spunem că expresia este în formă infixată dacă fiecare operator binar este încadrat de cei doi operanzi ai săi. Aceasta este de fapt forma uzuală a expresiilor aritmetice.&lt;br /&gt;
Spunem că expresia este în formă postfixată dacă fiecare operator este poziționat după operanzii săi, respectând prioritatea și regula de asociere a operatorilor.&lt;br /&gt;
De exemplu, expresia aritmetică în formă infixată: 1*2+3^4 poate fi rescrisă în forma postfixată astfel:&lt;br /&gt;
1*2+3^4 → (parantezare) → ((1*2)+(3^4)) → (postfixare +) → ((1*2)(3^4)+) → (postfixare * și ^) → &lt;br /&gt;
((1 2 *)(3 4 ^) +) → (eliminare paranteze) → 1 2 * 3 4 ^ +&lt;br /&gt;
Valoarea expresiei date este 83.&lt;br /&gt;
&lt;br /&gt;
== Date de intrare == &lt;br /&gt;
&lt;br /&gt;
Fișierul de intrare evaluareexpresie.in conține pe un singur rând un șir de caractere ce reprezintă o expresie aritmetică corect construită ce poate conține numai operatorii binari +, -, *, ^, cu semnificațiile de mai sus, și operanzi constante numere naturale.&lt;br /&gt;
&lt;br /&gt;
== Date de iesire == &lt;br /&gt;
&lt;br /&gt;
Fișierul de ieșire evaluareexpresie.out va conține pe prima linie un șir de caractere ce reprezintă forma postfixată a expresiei date, iar pe cel de-al doilea rând un număr natural ce reprezintă valoarea expresiei date. Pentru forma postfixată operanzii și operatorii vor fi separați cu câte un spațiu.&lt;br /&gt;
&lt;br /&gt;
== Restrictii si precizari == &lt;br /&gt;
&lt;br /&gt;
*Lungimea expresiei din fișierul de intrare va fi de cel mult 50 de caractere&lt;br /&gt;
*Rezultatul final precum și rezultatele intermediare se vor încadra în tipul de date long long&lt;br /&gt;
*Expresia este corectă și nu conține alte caractere în afară de cifre și operatorii +, -, *, ^&lt;br /&gt;
&lt;br /&gt;
== Exemplul 1 == &lt;br /&gt;
&lt;br /&gt;
; intrare&lt;br /&gt;
&lt;br /&gt;
:100-2*3^2&lt;br /&gt;
&lt;br /&gt;
; iesire&lt;br /&gt;
&lt;br /&gt;
:Datele introduse corespund restrictiilor impuse.&lt;br /&gt;
&lt;br /&gt;
:100 2 3 2 ^ * -&lt;br /&gt;
&lt;br /&gt;
:82&lt;br /&gt;
&lt;br /&gt;
== Exemplul 2 ==&lt;br /&gt;
&lt;br /&gt;
; intrare&lt;br /&gt;
&lt;br /&gt;
:89 1 2 1 ^ * -&lt;br /&gt;
&lt;br /&gt;
:62&lt;br /&gt;
&lt;br /&gt;
; iesire &lt;br /&gt;
&lt;br /&gt;
:Datele de intrare nu corespund restrictiilor impuse.&lt;br /&gt;
&lt;br /&gt;
== Rezolvare == &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;line=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
#3536 - EvaluareExpresie&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
#include &amp;lt;stack&amp;gt;&lt;br /&gt;
#include &amp;lt;cmath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
int prioritate(char op) {&lt;br /&gt;
    if (op == &amp;#039;^&amp;#039;) return 3;&lt;br /&gt;
    if (op == &amp;#039;*&amp;#039; || op == &amp;#039;/&amp;#039;) return 2;&lt;br /&gt;
    if (op == &amp;#039;+&amp;#039; || op == &amp;#039;-&amp;#039;) return 1;&lt;br /&gt;
    return 0; // pentru paranteze&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
string infixToPostfix(string expresie) {&lt;br /&gt;
    stack&amp;lt;char&amp;gt; stiva;&lt;br /&gt;
    string postfix;&lt;br /&gt;
    &lt;br /&gt;
    for (char &amp;amp;caracter : expresie) {&lt;br /&gt;
        if (isdigit(caracter)) {&lt;br /&gt;
            postfix += caracter;&lt;br /&gt;
        } else if (caracter == &amp;#039;(&amp;#039;) {&lt;br /&gt;
            stiva.push(caracter);&lt;br /&gt;
        } else if (caracter == &amp;#039;)&amp;#039;) {&lt;br /&gt;
            while (!stiva.empty() &amp;amp;&amp;amp; stiva.top() != &amp;#039;(&amp;#039;) {&lt;br /&gt;
                postfix += stiva.top();&lt;br /&gt;
                stiva.pop();&lt;br /&gt;
            }&lt;br /&gt;
            stiva.pop(); // eliminăm &amp;#039;(&amp;#039; din stivă&lt;br /&gt;
        } else {&lt;br /&gt;
            while (!stiva.empty() &amp;amp;&amp;amp; prioritate(stiva.top()) &amp;gt;= prioritate(caracter)) {&lt;br /&gt;
                postfix += stiva.top();&lt;br /&gt;
                stiva.pop();&lt;br /&gt;
            }&lt;br /&gt;
            stiva.push(caracter);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    while (!stiva.empty()) {&lt;br /&gt;
        postfix += stiva.top();&lt;br /&gt;
        stiva.pop();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    return postfix;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
int calculeazaValoare(string postfix) {&lt;br /&gt;
    stack&amp;lt;int&amp;gt; stiva;&lt;br /&gt;
&lt;br /&gt;
    for (char &amp;amp;caracter : postfix) {&lt;br /&gt;
        if (isdigit(caracter)) {&lt;br /&gt;
            stiva.push(caracter - &amp;#039;0&amp;#039;); // convertim caracterul în valoare numerică&lt;br /&gt;
        } else {&lt;br /&gt;
            int operand2 = stiva.top();&lt;br /&gt;
            stiva.pop();&lt;br /&gt;
            int operand1 = stiva.top();&lt;br /&gt;
            stiva.pop();&lt;br /&gt;
&lt;br /&gt;
            switch (caracter) {&lt;br /&gt;
                case &amp;#039;+&amp;#039;:&lt;br /&gt;
                    stiva.push(operand1 + operand2);&lt;br /&gt;
                    break;&lt;br /&gt;
                case &amp;#039;-&amp;#039;:&lt;br /&gt;
                    stiva.push(operand1 - operand2);&lt;br /&gt;
                    break;&lt;br /&gt;
                case &amp;#039;*&amp;#039;:&lt;br /&gt;
                    stiva.push(operand1 * operand2);&lt;br /&gt;
                    break;&lt;br /&gt;
                case &amp;#039;/&amp;#039;:&lt;br /&gt;
                    stiva.push(operand1 / operand2);&lt;br /&gt;
                    break;&lt;br /&gt;
                case &amp;#039;^&amp;#039;:&lt;br /&gt;
                    stiva.push(pow(operand1, operand2));&lt;br /&gt;
                    break;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    return stiva.top();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
int main() {&lt;br /&gt;
    string expresie;&lt;br /&gt;
    cout &amp;lt;&amp;lt; &amp;quot;Introduceti expresia infixata: &amp;quot;;&lt;br /&gt;
    getline(cin, expresie);&lt;br /&gt;
&lt;br /&gt;
    string postfix = infixToPostfix(expresie);&lt;br /&gt;
    cout &amp;lt;&amp;lt; &amp;quot;Expresia postfixata: &amp;quot; &amp;lt;&amp;lt; postfix &amp;lt;&amp;lt; endl;&lt;br /&gt;
&lt;br /&gt;
    int valoare = calculeazaValoare(postfix);&lt;br /&gt;
    cout &amp;lt;&amp;lt; &amp;quot;Valoarea expresiei este: &amp;quot; &amp;lt;&amp;lt; valoare &amp;lt;&amp;lt; endl;&lt;br /&gt;
&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aurelia Raluca</name></author>
	</entry>
</feed>