Advertisement
alch1337

Hello World

Sep 5th, 2011
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.41 KB | None | 0 0
  1. ///---main.cpp---\\\
  2.  
  3. #include<iostream>
  4. #include<conio.h>
  5. #include"write.h"
  6. #include"load.h"
  7. #include"show.h"
  8.  
  9. void main()
  10. {
  11.     CNapisz* pNapisz = new CNapisz;
  12.     CWczytaj* pWczytaj = new CWczytaj;
  13.     CPokaz* pPokaz = new CPokaz;
  14.     std::string Name;
  15.  
  16.     pNapisz->Pokaz();
  17.     pWczytaj->Wczytaj();
  18.     Name = pWczytaj->PokazDane();
  19.     pPokaz->Pokaz(Name);
  20.  
  21.     getch();
  22. }
  23.  
  24. ///---write.h---\\\
  25.  
  26. #include<iostream>
  27. #include<conio.h>
  28.  
  29. class CNapisz
  30. {  
  31.     public:
  32.         CNapisz() { };
  33.         virtual void Pokaz();
  34. };
  35.  
  36. ///---write.cpp---\\\
  37.  
  38. #include"write.h"
  39.  
  40. void CNapisz::Pokaz()
  41. {
  42.     std::cout << "Podaj swoje imie!" << std::endl;
  43. }
  44.  
  45. //---load.h---\\\
  46.  
  47. #include<iostream>
  48. #include<conio.h>
  49.  
  50. class CWczytaj
  51. {   private:
  52.         std::string m_sName;
  53.     public:
  54.         CWczytaj() { };
  55.         virtual void Wczytaj();
  56.         virtual std::string PokazDane() { return m_sName; };
  57. };
  58.  
  59. ///---load.cpp---\\\
  60.  
  61. #include<iostream>
  62. #include<conio.h>
  63. #include<string>
  64. #include"load.h"
  65.  
  66. void CWczytaj::Wczytaj()
  67. {
  68.     std::cin >> m_sName;
  69. }
  70.  
  71. ///---show.h---\\\
  72.  
  73. #include<iostream>
  74. #include<conio.h>
  75.  
  76. class CPokaz
  77. {  
  78.     public:
  79.         CPokaz() { };
  80.         virtual void Pokaz(std::string sName);
  81. };
  82.  
  83. ///---show.cpp---\\\
  84.  
  85. #include<iostream>
  86. #include<conio.h>
  87. #include<string>
  88. #include"show.h"
  89.  
  90. void CPokaz::Pokaz(std::string sName)
  91. {
  92.     std::cout << "Hello World!" << std::endl;
  93.     std::cout << "Twoje imie to " << sName << "!" << std::endl;
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement