slide1 n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Automobile PowerPoint Presentation
Download Presentation
Automobile

Loading in 2 Seconds...

play fullscreen
1 / 12

Automobile - PowerPoint PPT Presentation


  • 111 Views
  • Uploaded on

Automobile. -> In Piata Avram Iancu, la semafor, asteapta 15 automobile. Acestea se vor citi din fisierul masini.in si vor fi caracterizate de numarul de inmatriculare si culoare.Se cere: a) creati stiva cu automobilele; b) afisati stiva;

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Automobile' - rangle


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
slide2

-> In Piata Avram Iancu, la semafor, asteapta 15 automobile. Acestea se vor citi din fisierul masini.in si vor fi caracterizate de numarul de inmatriculare si culoare.Se cere:

a) creati stiva cu automobilele;

b) afisati stiva;

c) calculati cate automobile rosii, albastre si argintii se afla la semafor (pentru fiecare culoare in parte);

d) scrieti in fisierul auto.out automobilele care nu au numar de cluj ;

e) cand semaforul se face verde primele k automobile pleaca. Eliminati-le!

-> In Piata Avram Iancu, la semafor, asteapta 15 automobile. Acestea se vor citi din fisierul masini.in si vor fi caracterizate de numarul de inmatriculare si culoare.Se cere:

  • a) creati stiva cu automobilele;
  • b) afisati stiva;
  • c) calculati cate automobile rosii, albastre si argintii se afla la semafor (pentru fiecare culoare in parte);
  • d) scrieti in fisierul auto.out automobilele care nu au numar de cluj ;
  • e) cand semaforul se face verde primele k automobile pleaca. Eliminati-le!
slide3

-> Masini.in:

  • cj 27 ana verde
  • b 50 abc negru
  • cj 65 ioa albastru
  • cj 84 tim rosu
  • br 64 bic argintiu
  • cj 94 bia rosu
  • ar 44 kya negru
  • cj 63 tho galben
  • cj 14 mir albastru
  • cj 22 tri negru
  • cj 55 amk verde
  • b 24 kal argintiu
  • cj 52 orw argintiu
  • si 24 pro rosu
  • cj 24 vio argintiu
slide4

a) Crearea stivei

  • void creare (nod *&varf)
  • { nod *p;
  • int i,b;
  • char a[10],c[10],d[10];
  • for (i=1; i<=15; i++)
  • {f>>a; f>>b; f>>c; f>>d;
  • push (varf,a,b,c,d);
  • }
  • }
  • b)Afisarea stivei

void afisare (nod *varf)

{ nod *p;

p=varf;

while (p!=NULL)

{ SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 560);

cout<<p->loc<<" "<<p->nr<<" "<<p->lit<<" "<<p->cul<<endl;

cout<<"__________________"<<endl;

p=p->urm;

}

}

slide5

Masinile care asteapta la semafor:

Stiva:

cj 24 vio argintiu

si 24 pro rosu

cj 52 orw argintiu

b 24 kal argintiu

cj 55 amk verde

cj 22 tri negru

cj 14 mir albastru

cj 63 tho galben

ar 44 kya negru

cj 94 bia rosu

br 64 bic argintiu

cj 84 tim rosu

cj 65 ioa albastru

b 50 abc negru

cj 27 ana verde

Exemplul:

cj 27 ana verde

b 50 abc negru

cj 65 ioa albastru

cj 84 tim rosu

br 64 bic argintiu

cj 94 bia rosu

ar 44 kya negru

cj 63 tho galben

cj 14 mir albastru

cj 22 tri negru

cj 55 amk verde

b 24 kal argintiu

cj 52 orw argintiu

si 24 pro rosu

cj 24 vio argintiu

slide6

c) Contorizarea culorilor

  • void culori (nod *varf,int&cont1,int&cont2,int&cont3)
  • { nod *p;
  • p=varf;
  • while (p)
  • { if (strcmp(p->cul,"rosu")==0) cont1++;
  • else if (strcmp(p->cul,"albastru")==0) cont2++;
  • else if (strcmp(p->cul,"argintiu")==0) cont3++;
  • p=p->urm;
  • }
  • }
slide7

Masini rosii: 3

  • Masini albastre: 2
  • Masini argintii: 4
slide8

d) masinile din afara clujului

  • void numar (nod *varf)
  • { nod *p;
  • p=varf;
  • while (p)
  • { if (strcmp(p->loc,"cj")!=0)
  • g<<p->loc<<" "<<p->nr<<" "<<p->lit<<" "<<p->cul<<endl;
  • p=p->urm;
  • }
  • }
slide9

In fisierul auto.out:

  • si 24 pro rosu
  • b 24 kal argintiu
  • ar 44 kya negru
  • br 64 bic argintiu
  • b 50 abc negru
slide10

e) eliminarea primelor k masini

  • void pop (nod *&varf)
  • { nod *p;
  • p=varf;
  • varf=varf->urm;
  • delete p;
  • }
slide11

de exemplu k=5;

  • se va afisa:
        • cj 22 tri negru
        • cj 14 mir albastru
        • cj 63 tho galben
        • ar 44 kya negru
        • cj 94 bia rosu
        • br 64 bic argintiu
        • cj 84 tim rosu
        • cj 65 ioa albastru
        • b 50 abc negru
        • cj 27 ana verde
slide12

Au contribuit:

  • Bojan Roxana
  • Bretea enisa
  • Chereches Luana
  • Chira Luiza
  • Felecan Bianca
  • Ranga Ramona