Advertisement
B1LLy

struktury1

Jan 23rd, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.96 KB | None | 0 0
  1. // ConsoleApplication25.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. #include <string>
  7. #include <cstdlib>
  8.  
  9. using namespace std;
  10.  
  11. struct ksiazka
  12. {
  13.     string tytul;
  14.     string autor;
  15.     float wartosc;
  16. };
  17.  
  18.  
  19. int main(void)
  20. {
  21.  
  22.     struct ksiazka bibl; // deklaracja obiektu bibl jako zmiennej |
  23.     cout << "podaj tytul ksiazki. \n";
  24.     setlocale(LC_ALL, "");
  25.     getline(cin, bibl.tytul); //dostep do skladnika
  26.     cout << "teraz podaj autora. \n";
  27.     getline(cin, bibl.autor);
  28.     setlocale(LC_ALL, "");
  29.     cout << "teraz podaj wartość. \n";
  30.     setlocale(LC_ALL, "");
  31.     cin >> bibl.wartosc;
  32.     cout << bibl.tytul << " autor:  " << bibl.autor;
  33.     setlocale(LC_ALL, "");
  34.     cout << "  wartość:  ";
  35.     setlocale(LC_ALL, "C");
  36.     cout << bibl.wartosc << endl;
  37.     setlocale(LC_ALL, "C");
  38.     cout << bibl.autor << "  " << bibl.tytul << "  " << bibl.wartosc << endl;
  39.     cout << "gotowe. \n";
  40.     getchar();
  41.     getchar();
  42.  
  43.  
  44.     return 0;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement