1 / 5

Ziua de votare

Hoduţ Riana, Donca Vlad. Ziua de votare. La o secţie de vot persoanele stau la coadă pentru a vota. Fiecare persoană e inregistrată cu nume, prenume şi CNP şi intră în ordine la vot - primul intrat e primul ieşit . Să se construiască un program care simlueaza acest lucru.

zubeda
Télécharger la présentation

Ziua de votare

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Hoduţ Riana, Donca Vlad Ziua de votare

  2. La o secţie de vot persoanele stau la coadă pentru a vota. Fiecare persoană e inregistrată cu nume, prenume şi CNP şi intră în ordine la vot - primul intrat e primul ieşit. Să se construiască un program care simlueaza acest lucru. Enunţ

  3. #include<iostream.h> #include<string.h> #include<fstream.h> fstream f("date.txt",ios::in); struct nod { char nume[50],prenume[50] , cnp[50]; nod *urm;}; nod *prim, *ultim; char n[50],p[50],c[50]; int r=0; int o=0; void creare() {nod *nou; if(prim==NULL) { prim=new nod; strcpy(prim->nume,n); strcpy(prim->prenume,p); strcpy(prim->cnp,c); prim->urm=NULL; ultim=prim;} else { nou=new nod; strcpy(nou->nume,n); strcpy(nou->prenume,p); strcpy(nou->cnp,c); nou->urm=NULL; ultim->urm=nou; ultim=nou;}} void afisare() {nod *p=prim; while(p!=NULL){ cout<<p->nume<<" "<<p->prenume<<" "<<p->cnp<<endl<<endl; p=p->urm; } } void stergere() { while(prim!=NULL) { cout<<"a votat si a iesit al "<<r-o<<"-lea din lista de la inceput"<<endl<<endl; nod *aux; aux=prim; prim=prim->urm; delete aux; afisare(); o=o-1; cout<<endl; } if(prim==NULL) cout<<" NU A RAMAS NICI O PERSOANA";} main() {prim=NULL; while(!f.eof()){f.get(n,50); f.get(); f.get(p,50); f.get(); f.get(c,50); f.get(); creare();} afisare();cout<<endl; nod *p=prim; while(p){ r++; p=p->urm;} o=r-1; stergere();} REZOLVARE

  4. SIMULARE prim dan polni 1700403369854 tiberiu popescu 1730518365894 dana manoliu 2850923365894 ultim doru crisan 1690228635241 NULL

  5. SIMULARE aux prim dan polni 1700403369854 prim aux tiberiu popescu 1730518365894 prim aux dana manoliu 2850923365894 prim ultim prim doru crisan 1690228635241 NULL aux

More Related