Advertisement
Guest User

Untitled

a guest
Jan 28th, 2015
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.91 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. struct produkt{
  4.     string nazwa;
  5.     string producent;
  6.     unsigned int cena;
  7.  
  8.     void wypisz()
  9.     {
  10.         cout << "Nazwa: "<<nazwa<<" producent "<<producent<< " cena "<<cena<<endl ;
  11.     }
  12.     void pobierz(){
  13.         cout <<"Podaj nazwe "<<endl;
  14.         cin >> nazwa;
  15.         cout <<"Podaj producenta"<<endl;
  16.         cin >> producent;
  17.         cout <<"Podaj cene "<<endl;
  18.         cin >> cena;
  19.         cout<<endl;
  20.     }
  21. };
  22.  
  23. void wczytajN(int n,struct produkt* table){
  24.     for(int i=0;i<n;i++){
  25.         table[i].pobierz();
  26.     }
  27. }
  28. void wypiszN(int n,struct produkt* table){
  29.     cout<<"Oto klienci"<<endl;
  30.     for(int i=0;i<n;i++){
  31.         table[i].wypisz();
  32.     }
  33. }
  34. int main()
  35. {
  36.     int n;
  37.     cout << "Podaj ilosc produktΓ³w " << endl;
  38.     cin>> n;
  39.     struct produkt table[n];
  40.  
  41.     wczytajN(n,table);
  42.     wypiszN(n,table);
  43.  
  44.     return 0;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement