Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int m[5][2] = { { 1,4 },{ 1,2 },{ 3,2 },{ 3,4 },{ 4,4 } };
- char c[50];
- for (int i = 0; i<5; i++)
- {
- cin >> c;
- int k = strlen(c);
- int q = 0;
- for (int j = 0; (j<k) && (q != 4); j++)
- {
- int x = c[j] - '0';
- cout << x << endl;
- q = m[q][x];
- cout << q << endl;
- }
- if (q == 3)
- cout << "принадлежит" << endl;
- else cout << "error";
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment