consolidate all repos to one for archive
This commit is contained in:
13
semester_1/programiranje_1/Vaje/Vaja_12/Telefon.txt
Normal file
13
semester_1/programiranje_1/Vaje/Vaja_12/Telefon.txt
Normal file
@@ -0,0 +1,13 @@
|
||||
Nik 11 12 2000 Samsung 500 Android 4.5 Samsung 50.6 OneUI
|
||||
sgd 15 12 2001 adsf 52 dgh 4.3 dfhg 35 daf
|
||||
pet 15 12 2000 Apple 200 IOS 2.6 Apple 60.7 IOE
|
||||
ads 9 10 2001 agds 45 df 1.9 dfs 46 hfs
|
||||
ses 09 11 2000 sg 354 dhg 4.5 sd 56 cnv
|
||||
fads 20 11 2000 gsd 346 dhg 2.6 sf 67 bnc
|
||||
vcyx 9 10 2000 hsf 236 gdh 2.9 hgdf 46 sgh
|
||||
xb 9 11 2001 gas 64 cnb 4.9 df 64 jhdf
|
||||
afe 20 11 2001 ags 765 jgf 2.6 sdf 57 sdhg
|
||||
ghdf 16 10 2001 ags 764 dg 2.8 gf 35 jhdg
|
||||
|
||||
|
||||
Nik 11 12 2000 Samsung 500 Android 4.5 Samsung 50.6 OneUI sgd 15 12 2001 adsf 52 dgh 4.3 dfhg 35 daf pet 15 12 2000 Apple 200 IOS 2.6 Apple 60.7 IOE ads 9 10 2001 agds 45 df 1.9 dfs 46 hfs ses 09 11 2000 sg 354 dhg 4.5 sd 56 cnv fads 20 11 2000 gsd 346 dhg 2.6 sf 67 bnc vcyx 9 10 2000 hsf 236 gdh 2.9 hgdf 46 sgh xb 9 11 2001 gas 64 cnb 4.9 df 64 jhdf afe 20 11 2001 ags 765 jgf 2.6 sdf 57 sdhg ghdf 16 10 2001 ags 764 dg 2.8 gf 35 jhdg
|
121
semester_1/programiranje_1/Vaje/Vaja_12/Telefon_struct/main.cpp
Normal file
121
semester_1/programiranje_1/Vaje/Vaja_12/Telefon_struct/main.cpp
Normal file
@@ -0,0 +1,121 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
struct Datum{
|
||||
int dan, mesec, leto;
|
||||
};
|
||||
|
||||
struct PametnaUra{
|
||||
string brand;
|
||||
float cena;
|
||||
string opSistem;
|
||||
};
|
||||
|
||||
struct Telefon{
|
||||
string ime;
|
||||
Datum datum_nakupa;
|
||||
PametnaUra ura;
|
||||
float GHz;
|
||||
string brand;
|
||||
float cena;
|
||||
string opSistem;
|
||||
};
|
||||
|
||||
void upis(Telefon *polje[10],int st){
|
||||
for(int i = 0; i<st; i++){
|
||||
polje[i] = new Telefon;
|
||||
cout<<"Ime naprave:";
|
||||
cin>>polje[i]->ime;
|
||||
cout<<"Dan nakupa:";
|
||||
cin>>polje[i]->datum_nakupa.dan;
|
||||
cout<<"Mesec nakupa:";
|
||||
cin>>polje[i]->datum_nakupa.mesec;
|
||||
cout<<"Leto nakupa:";
|
||||
cin>>polje[i]->datum_nakupa.leto;
|
||||
cout<<"Brand od ure:";
|
||||
cin>>polje[i]->ura.brand;
|
||||
cout<<"Cena ure:";
|
||||
cin>>polje[i]->ura.cena;
|
||||
cout<<"Operacijski sistem ure:";
|
||||
cin>>polje[i]->ura.opSistem;
|
||||
cout<<"Hitrost procesorja:";
|
||||
cin>>polje[i]->GHz;
|
||||
cout<<"Znamka telefona:";
|
||||
cin>>polje[i]->brand;
|
||||
cout<<"Cena telefona:";
|
||||
cin >>polje[i]->cena;
|
||||
cout<<"Operacijski sistem telefona:";
|
||||
cin>>polje[i]->opSistem;
|
||||
cout<<endl<<endl;
|
||||
}
|
||||
}
|
||||
|
||||
void izpis(Telefon *polje[10],int st){
|
||||
for(int i = 0; i<st; i++){
|
||||
cout<<"Ime naprave:"<<polje[i]->ime<<endl;
|
||||
cout<< "Datum nakupa:";
|
||||
cout<<polje[i]->datum_nakupa.dan<<".";
|
||||
cout<<polje[i]->datum_nakupa.mesec<<".";
|
||||
cout<<polje[i]->datum_nakupa.leto<<endl;
|
||||
cout<<"Brand od ure:" << polje[i]->ura.brand<<endl;
|
||||
cout<<"Cena ure:" << polje[i]->ura.cena<<endl;
|
||||
cout<<"Operacijski sistem ure:" << polje[i]->ura.opSistem<<endl;
|
||||
cout<<"Hitrost procesorja:" << polje[i]->GHz<<endl;
|
||||
cout<<"Znamka telefona:" << polje[i]->brand<<endl;
|
||||
cout<<"Cena telefona" << polje[i]->cena<<endl;
|
||||
cout<<"Operacijski sistem telefona:" << polje[i]->opSistem<<endl;
|
||||
cout<<endl<<endl;
|
||||
}
|
||||
}
|
||||
|
||||
void sort(Telefon *polje[10],int st){
|
||||
|
||||
for (int j = 0; j < st; j++){
|
||||
for (int i = 0; i < st-j-1;i++){
|
||||
|
||||
if (polje[i]->datum_nakupa.leto > polje[i+1]->datum_nakupa.leto){
|
||||
Telefon *tmp;
|
||||
tmp = polje[i];
|
||||
polje[i]=polje[i+1];
|
||||
polje[i+1]=tmp;
|
||||
}
|
||||
|
||||
if (polje[i]->datum_nakupa.leto == polje[i+1]->datum_nakupa.leto){
|
||||
if (polje[i]->datum_nakupa.mesec > polje[i+1]->datum_nakupa.mesec){
|
||||
Telefon *tmp;
|
||||
tmp = polje[i];
|
||||
polje[i]=polje[i+1];
|
||||
polje[i+1]=tmp;
|
||||
}
|
||||
}
|
||||
|
||||
if (polje[i]->datum_nakupa.leto == polje[i+1]->datum_nakupa.leto){
|
||||
if (polje[i]->datum_nakupa.mesec == polje[i+1]->datum_nakupa.mesec){
|
||||
if (polje[i]->datum_nakupa.dan > polje[i+1]->datum_nakupa.dan){
|
||||
Telefon *tmp;
|
||||
tmp = polje[i];
|
||||
polje[i]=polje[i+1];
|
||||
polje[i+1]=tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main(){
|
||||
int st = 10;//stevilo telefonov
|
||||
Telefon *polje[10]; // Ustvarimo polje kazalcev
|
||||
|
||||
upis(polje,st);
|
||||
sort(polje,st);
|
||||
izpis(polje,st);
|
||||
|
||||
// Sprostimo rezerviran pomnilnik
|
||||
for(int i = 0; i<st; i++){
|
||||
delete polje[i];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user