Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<fstream>
- using namespace std;
- #include "Stack.cpp"
- ifstream in("input.txt");
- ofstream out("output.txt");
- int main()
- {
- Stack<double> t, t2;
- int i, n;
- double k = 0, s = 0;
- while (in >> i)
- {
- t.Push(i);
- }
- in.close();
- while (!t.Empty())
- {
- n = t.Pop();
- if (n % 2 == 0)
- {
- k++;
- s += n;
- t2.Push(n);
- }
- }
- double ss = 0;
- ss = s / k;
- t2.Push(ss);
- while (!t2.Empty())
- {
- cout << t2.Pop() << ' ';
- }
- //out << endl;
- //out << "sredarf = " << ss;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement