Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<string.h>
- using namespace std;
- int main()
- {
- char s[11];
- cin >> s;
- // Varianta complicaciune
- /*for (int i = strlen(s); i >= 0; i--) {
- char temp[11];
- strncpy(temp, s, i);
- temp[i] = '\0';
- cout << temp;
- if (i != 0) {
- cout << endl;
- }
- }*/
- for (int i = 0; i < strlen(s); i++) {
- for (int j = 0; j < (strlen(s) - i); j++) {
- cout << s[j];
- }
- cout << endl;
- }
- cout << "-----" << endl;
- // Varianta complicaciune
- //for (int i = 0; i < strlen(s); i++) {
- // char temp[11];
- // strcpy(temp, s + i);
- // cout << temp << endl;
- //}
- for (int i = 0; i < strlen(s); i++) {
- for (int j = i; j < strlen(s); j++) {
- cout << s[j];
- }
- cout << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment