-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSamoch.cpp
More file actions
40 lines (36 loc) · 947 Bytes
/
Copy pathSamoch.cpp
File metadata and controls
40 lines (36 loc) · 947 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
struct TSamochod {
string marka;
string model;
int rocznik;
int liczba_drzwi
};
void wypisz_samochody(const TSamochod *stab, int N)
{
string kreska(34, '-');
cout << kreska << endl;
for (int i = 0; i < N; i++) {
cout << "|" << setw(10) << stab[i].marka << " | " << setw(10) << stab[i].model << " | " << setw(5) << stab[i].rocznik << " |" << endl;
}
cout << kreska << endl << endl;
}
TSamochod* fnajstarszy(TSamochod *samochody, int ilosc)
{
//...
//...
return samochody;
}
int main()
{
TSamochod komis[10] = { { "opel", "zafira", 2010 }, { "ford", "focus", 2012 }, { "toyota","avensis",2005 }, {"fiat","panda",2008} };
int ilosc_samochodow = 4;
TSamochod* stary = fnajstarszy(komis, ilosc_samochodow);
wypisz_samochody(komis, ilosc_samochodow);
cout << "Najstarszy samochod to:"<< endl;
wypisz_samochody(stary, 1);
system("date");
return 1;
}