Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <stdio.h>
- #include <fstream>
- #include <cctype>
- using namespace std;
- void fun(string s)
- {
- cout << "start: " << s << "\n";
- long mas = 0;
- cout << "f_s " << isdigit(s[0]) << "> " << s[0] << " -> ";
- if (isdigit(s[0]))
- {
- mas = int(s[0]) - 48;
- cout << "set " << mas;
- }
- else cout << "none";
- cout << "\n";
- bool now, last;
- for (int i = 1; i < s.length(); i++)
- {
- now = isdigit(s[i]);
- last = isdigit(s[i - 1]);
- cout << "0: " << (int)now << " " << (int)last << "> char: " << s[i] << "\n";
- if (now && !last)
- {
- mas = int(s[i]) - 48;
- cout << "1> n & !l -> " << mas << "\n";
- }
- if (now && last)
- {
- mas = mas * 10 + int(s[i]) - 48;
- cout << "2> n & l -> " << mas << "\n";
- }
- if (!now && last)
- {
- cout << "3> !n & l -> " << mas << "\n";
- if (mas % 2 == 0)
- cout << mas << ' ';
- }
- if (now && (i = s.length()-1))
- {
- cout << "4> n & length -> " << mas << "\n";
- if (mas % 2 == 0)
- cout << mas << ' ';
- }
- }
- cout << endl;
- }
- int main()
- {
- string s;
- ifstream in("input.txt");
- while (in.peek() != EOF)
- {
- getline(in, s);
- fun(s);
- }
- in.close();
- //system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement