Advertisement
WiktoriaRatajczyk

Sprawdzian Wiktoria Ratajczyk 4bTI

Oct 26th, 2020
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.28 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     //zadanie 1
  8.     //a)
  9.     int x=25;
  10.     //b)
  11.     int *wsk_x=&x;
  12.     //c)
  13.     *wsk_x=x*10;
  14.     //d)
  15.     cout<<*wsk_x<<endl;
  16.  
  17.     //zadanie 2
  18.     //a)
  19.     struct Posciel {
  20.     float szerokosc1;
  21.     float dlugosc1;
  22.     string kolor1;
  23.     int cena1;
  24.     string producent1;
  25.     };
  26.     //b)
  27.     float szerokosc1=2.50;
  28.     float dlugosc1=2.20;
  29.     string kolor1="czerwony";
  30.     int cena1=120;
  31.     string producent1="fajna-posciel";
  32.     //c)
  33.     cout<<"Oto nasza posciel o szerokosci "<<szerokosc1<<"m, dlugosci "<<dlugosc1<<"m, producenta '"<<producent1<<"', koloru: "<<kolor1<<" juz teraz w cenie "<<cena1<<" zlotych!!"<<endl;
  34.  
  35.     //zadanie 3
  36.     //a)
  37.     class posciel
  38.     {
  39.     public:
  40.         float szerokosc2;
  41.         float dlugosc2;
  42.         string kolor2;
  43.         int cena2;
  44.         string producent2;
  45.  
  46.     //b)
  47.     float szerokosc=3.20;
  48.     float dlugosc=3.10;
  49.     string kolor="zielony";
  50.     int cena=180;
  51.     string producent="lepsza-posciel";
  52.  
  53.     //c)
  54.     void wyswietl ()
  55.     {
  56.         cout<<"Oto nasza posciel o szerokosci "<<szerokosc2<<"m, dlugosci "<<dlugosc2<<"m, producenta '"<<producent2<<"', koloru: "<<kolor2<<" juz teraz w cenie "<<cena2<<" zlotych!!"<<endl;
  57.     }
  58.     };
  59.  
  60.  
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement