Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- prima problema la lab 4 asd:
- #include <iostream>
- using namespace std;
- struct Nod{
- int info;
- Nod *link;
- };
- Nod *HEAD=NULL;
- void creareLista(int n);
- void afisareLista();
- int main()
- {
- int n,opt;
- cout<<"n;";
- cin>>n;
- creareLista(n);
- afisareLista();
- return 0;
- }
- void creareLista(int n){
- for(int i=0;i<n;i++){
- Nod *p=new Nod;
- cin>>p->info;
- p->link=HEAD;
- HEAD=p;
- }
- }
- void afisareLista(){
- for(Nod *iter=HEAD;iter!=NULL;iter=iter->link){
- cout<<iter->info<<"->";
- }cout<<"NULL"<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement