programming.h
class Programming { private: int variable; public: void Input_value(); void Output_value(); };
programming.cpp
#include "programming.h" #include<iostream> using namespace std; void Programming::Input_value() { cout << "Zadaj cislo :\n"; cin >> variable; } void Programming::Output_value() { cout << "Bolo zadane cislo "; cout << variable << "\n"; }
main.cpp
#include "programming.h" int main() { Programming object; object.Input_value(); object.Output_value(); return 0; }
Output:
Zadaj cislo : 22 Bolo zadane cislo 22