Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <stdio.h>
- #include <iostream>
- #include <string>
- using namespace std;
- struct Item
- {
- char part[20];
- Item *next;
- };
- typedef Item* Point;
- void Create(Point &Head)
- {
- Point P, Last = NULL;
- char ch;
- cout << "Vuvedi element? ";
- cin >> ch;
- while (ch == 'Y' || ch == 'y')
- {
- P = new Item;
- cin >> P->part;
- P->next = NULL;
- if (Head == NULL)
- {
- Head = P;
- }
- else
- {
- Last->next = P;
- }
- Last = P;
- cout << "Vuvedi element? ";
- cin >> ch;
- }
- }
- void PrintElements(Point P, char *word)
- {
- while (P)
- {
- cout << P->part << word;
- P = P->next;
- }
- }
- void main()
- {
- Point Head = NULL;
- Create(Head);
- char keyword[20];
- cout << "Vuvedete kodova duma: ";
- cin >> keyword;
- PrintElements(Head, keyword);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement