Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- #include <stdio.h>
- #include <cstdlib>
- #include <ctype.h>
- using namespace std;
- int main()
- {
- char c[100];
- cin >> c;
- unsigned n = strlen(c);
- int ok = 0;
- cout << "prima litera: " << c[0] << endl << "ultima litera: " << c[n - 1] << endl;
- do
- {
- char c2[100];
- cin >> c2;
- cout << c[0];
- for (int i = 1; i < n - 1; i++)
- if (c[i] == c2[i])
- cout << c[i];
- else
- cout << '*';
- cout << c[n - 1];
- cout << endl;
- if (!strcmp(c, c2))
- ok = 1;
- }
- while (!ok);
- puts("Ai ghicit!");
- return 0;
- }
Add Comment
Please, Sign In to add comment