ahmed0saber

Include saber.hpp in C++

Nov 19th, 2020
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. A file named saber.hpp:-
  2.  
  3. #ifndef my_header
  4. #define my_header
  5. #include <iostream>
  6. using namespace std;
  7. int a=0;
  8. saber_prints(string x=""){
  9.     cout<<x;
  10. }
  11. saber_printi(int x=0){
  12.     cout<<x;
  13. }
  14. saber_endline(){
  15.     cout<<endl;
  16. }
  17. class saber_int
  18. {
  19.     public:
  20.     int value;
  21. };
  22. #endif
  23.  
  24.  
  25.  
  26. A cpp file:-
  27.  
  28. #include "saber.hpp"
  29. int main()
  30. {
  31.     saber_prints("Hello\nEnter the first number : ");
  32.     saber_int num1;
  33.     saber_int num2;
  34.     cin>>num1.value;
  35.     saber_prints("Enter the second number : ");
  36.     cin>>num2.value;
  37.     saber_endline();
  38.     saber_prints("The sum = ");
  39.     saber_printi(num1.value+num2.value);
  40. }
Advertisement
Add Comment
Please, Sign In to add comment