Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- struct List{
- int f;
- struct List * next;
- };
- List* create(){
- List *pom=new List;
- pom->next=NULL;
- return pom;
- }
- List* back(List *Lista){
- while(Lista->next!= NULL)
- Lista = Lista->next;
- return Lista;
- }
- void push_back(List *Lista, int f){
- List *pom=back(Lista);
- List *nowy=new List;
- nowy->f=f;
- nowy->next=NULL;
- pom->next=nowy;
- }
- void wyswietl(List **t, int ilosc_el)// wyświeltam zapisane informacje
- {
- for(int i = 0; i < 10; i++)// ilość elementów w "głównej" tablicy
- {
- cout << "Tablica o indeksie: " << i << " ";
- List *pom = t[i];
- while(pom)// przeszukuje liste dla kazdego elementu "głownej" tablicy
- {
- cout << pom->f<< " ";
- pom = pom->next;
- }
- std::cout << std::endl;
- }
- }
- int main(){
- int f,m,o;
- int n;
- cin>>n;
- const int ilosc_el=10;
- List **tablica = new List *[ilosc_el];
- for(int i = 0; i < ilosc_el; i++)
- tablica[i] = 0;
- for(int i = 0; i < n; i++){
- cin >> o >> m >> f;
- if (o==0)
- {
- }
- if (o==1)
- {
- }
- if (o==2)
- {
- }
- }
- wyswietl(tablica,ilosc_el);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement