Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- struct nod
- {
- int info;
- nod* urm;
- };
- int n,i;
- nod *p,*prim,*ultim;
- void creare()
- {
- cin>>n;
- for(i=1;i<=n;i++)
- {
- p=new nod;
- p->urm=NULL;
- cin>>p->info;
- if(prim==NULL)
- {
- prim=p;
- ultim=p;
- }
- else{
- ultim->urm=p;
- ultim=p;
- }
- }
- }
- int sub(nod* lala,int k)
- {nod *ehe;
- int nr=0;
- for(ehe=lala;ehe!=NULL;ehe=ehe->urm)
- {
- if(k>=ehe->info)
- {
- nr++;
- }
- }
- return nr;
- }
- int main()
- {int p;
- creare();
- cin>>p;
- nod* op;
- /*for(op=prim;op!=NULL;op=op->urm)
- cout<<op->info<<" ";*/
- cout<<sub(prim,p);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement