aboutsummaryrefslogtreecommitdiff
path: root/semestr-3/pf/lista2/cze.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'semestr-3/pf/lista2/cze.cpp')
-rw-r--r--semestr-3/pf/lista2/cze.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/semestr-3/pf/lista2/cze.cpp b/semestr-3/pf/lista2/cze.cpp
new file mode 100644
index 0000000..da58fa5
--- /dev/null
+++ b/semestr-3/pf/lista2/cze.cpp
@@ -0,0 +1,29 @@
+#include <iostream>
+using namespace std;
+
+int tab[1000010];
+
+int main()
+{
+ int wsk = 0;
+
+ while (true)
+ {
+ cin >> tab[wsk];
+ if (tab[wsk] == -1)
+ break;
+ wsk++;
+ }
+
+ for (int i = 0; i < wsk; i += 2) // i += 2 <=> i = i + 2
+ {
+ cout << tab[i] << " ";
+ }
+ cout << "-1\n";
+
+ for (int i = 1; i < wsk; i += 2)
+ {
+ cout << tab[i] << " ";
+ }
+ cout << "-1\n";
+} \ No newline at end of file