Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- struct produkt{
- string nazwa;
- string producent;
- unsigned int cena;
- void wypisz()
- {
- cout << "Nazwa: "<<nazwa<<" producent "<<producent<< " cena "<<cena<<endl ;
- }
- void pobierz(){
- cout <<"Podaj nazwe "<<endl;
- cin >> nazwa;
- cout <<"Podaj producenta"<<endl;
- cin >> producent;
- cout <<"Podaj cene "<<endl;
- cin >> cena;
- cout<<endl;
- }
- };
- void wczytajN(int n,struct produkt* table){
- for(int i=0;i<n;i++){
- table[i].pobierz();
- }
- }
- void wypiszN(int n,struct produkt* table){
- cout<<"Oto klienci"<<endl;
- for(int i=0;i<n;i++){
- table[i].wypisz();
- }
- }
- int main()
- {
- int n;
- cout << "Podaj ilosc produktΓ³w " << endl;
- cin>> n;
- struct produkt table[n];
- wczytajN(n,table);
- wypiszN(n,table);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement