Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- struct pogoda
- {
- string opis;
- double temp;
- bool czyPada;
- };
- void wczytaj (pogoda &p)
- {
- char c;
- cout<<"Podaj opis: ";
- cin>> p.opis;
- cout<<"Podaj temperature: ";
- cin >> p.temp;
- while(true)
- {
- cout<< "Podaj czy pada (T/N): ";
- cin >>c;
- if(c=='T' || c=='t')
- {
- p.czyPada = true;
- break;
- }
- else if(c=='N' || c=='n')
- {
- p.czyPada=false;
- break;
- }
- else
- {
- cout <<"zla wartosc"<<endl;
- }
- }
- }
- ostream &operator<<(ostream &s, const pogoda&p)
- {
- s<<p.opis"," <<p.temp<<"," <<p.czyPada<<"," <<")"<<endl;
- return s;
- }
- int main(int argc, char** argv)
- {
- pogoda* dane;
- int ile;
- cout <<"ile odczytow chcesz podac?";
- cin >> ile;
- dane = new pogoda[ile];
- for(int i=0; i<ile; i++)
- {
- cout << "Podaj dane odczytu nr " << (i+1) << endl;
- wczytaj(dane[i]);
- }
- for(int i=0; i<ile; i++)
- {
- cout << "Odczyt nr " << (i+1) << endl;
- cout<< dane[i]<<endl ;
- cout << dane[i];
- }
- delete [] dane;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement