Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- struct pies {
- string rasa;
- string wlasciciel;
- int wiek;
- };
- int main(){
- pies p1={"Jamnik", "Jan Kowalski", 2};
- pies p2={"Labrador", "Anna Marciniak", 5};
- pies p3={"York", "Stanisław Wokulski", 4};
- pies tab[5];
- tab[0]=p1;
- tab[1]=p2;
- tab[2]=p3;
- for(int j = 3;j < 5;j++){
- cout<<"Podaj kolejno: rase psa, imie i nazwisko jego wlasciciela i wiek psa"<<endl;
- cin>>tab[j].rasa>>tab[j].wlasciciel>>tab[j].wiek;
- }
- int wiekmax=tab[0].wiek;
- for(int i=0; i<5;i++){
- if(wiekmax<tab[i].wiek)
- wiekmax=tab[i].wiek;
- }
- cout<<wiekmax<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement