pjobro

3.4.klase..

Apr 3rd, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.24 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include<iostream>
  3. #include<string>
  4.  
  5. using namespace std;
  6.  
  7. class Covik {
  8. public:
  9.     string ime;
  10.     string prezime;
  11.     int age;
  12.     void set_ime();
  13.     void set_prezime();
  14.     void set_age();
  15. };
  16.  
  17. int main()
  18. {
  19.     /*Covik human;
  20.     human.ime = "pero";
  21.     cout << human.ime << endl;
  22.  
  23.     human.set_prezime();*/
  24.    
  25.     return 0;
  26.    
  27. }
  28.  
  29. void Covik::set_ime() {
  30.     ime = "jure";
  31. }
  32.  
  33. void Covik::set_prezime() {
  34.     prezime = "juric";
  35.     cout << prezime;
  36. }
  37. void Covik::set_age() {
  38.     ime = 100;
  39. }
  40.  
  41. //heder
  42. #ifndef ziv_h
  43. #define ziv_h
  44. #include<string>
  45.  
  46. class ziv {
  47. public:
  48.     std::string vrsta;
  49.     int age;
  50.     bool opasan;
  51.     void ispis();
  52.    
  53. };
  54. #endif // !1
  55.  
  56.  
  57. //mian cpp
  58.  
  59. void ziv::ispis() {
  60.    
  61.     cout << "vrsta: " << endl;
  62.     cin >> vrsta;
  63.     cout << "jel opasan: ";
  64.     if (opasan == true) { cout << "opasan je" << endl; }
  65.     else { cout << "nije opasan" << endl; }
  66.     cout << "koliko godina: " << endl;
  67.     cin >> age;
  68.     cout << age;
  69. }
  70.  
  71. int main()
  72. {
  73.     ziv sarko;
  74.     sarko.ispis();
  75.    
  76.     return 0;
  77. }
  78.  
  79. //kocka
  80. #include "stdafx.h"
  81. #include<iostream>
  82. #include<string>
  83.  
  84. using namespace std;
  85.  
  86. class Cube {
  87. private:int visina;
  88.         int sirina;
  89.         int dubina;
  90. public:void otvori();
  91.        void zatvori();
  92.        void kocka(int a,int b, int c);
  93. };
  94.  
  95. int main()
  96. {
  97.     Cube kockica;
  98.     kockica.kocka(1,1,1);
  99.     kockica.otvori();
  100.  
  101.     return 0;
  102. }
  103.  
  104. void Cube::otvori() {
  105.     if (sirina > 10) { cout << "zatvoreno"; }
  106.     else { cout << "otvoreno"; }
  107. }
  108.  
  109. void Cube::kocka(int a, int b, int c) {
  110.     cout << "napravi kocku(visina,sirina,dubina)" << endl;
  111.     visina = a;
  112.     sirina = b;
  113.     dubina = c;
  114.     cin >> a;
  115.     cin >> b;
  116.     cin >> c;
  117.     cout << "dimencijze kocke su: " << a << "x" << b << "x" << c << endl;
  118. }
  119.  
  120. ////autic;...ne radi return.
  121. #include "stdafx.h"
  122. #include<iostream>
  123. #include<string>
  124.  
  125. using namespace std;
  126.  
  127. class autic {
  128. private:string marka;
  129.     string model;
  130.     int sasija;
  131. public:
  132.     void set_automobil(string markica);
  133.     int get_automobil();
  134.     void upali();
  135.     void ugasi();
  136.     void speed();
  137.     void uspori();
  138. };
  139.  
  140. int main(){
  141.     autic car;
  142.     string rand;
  143.     cin >> rand;
  144.     car.set_automobil(rand);
  145.     cout << " "<<car.get_automobil();
  146.    
  147.     return 0;
  148. }
  149.  
  150. void autic::set_automobil(string markica) {
  151.     marka = markica;
  152. }
  153.  
  154. int autic::get_automobil() {
  155.     return marka;
  156. }
Add Comment
Please, Sign In to add comment