Guest User

Untitled

a guest
Jul 19th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.00 KB | None | 0 0
  1. the header file is addition.h
  2. below is header
  3. --------------------------
  4. #ifndef addition.h
  5. #define addition.h
  6.  
  7. int add(int x, int y)
  8. {
  9.     return x + y
  10. }
  11. #endif // addition.h
  12.  
  13.  
  14.  
  15.  
  16. Below is the main
  17. --------------------------
  18. #include <iostream>
  19. #include "addition.h"
  20.  
  21. using namespace std;
  22.  
  23. int main()
  24. {
  25.  
  26.     // This is like my first program ever.  Woot.
  27.     // Hopefully this becomes ever so nostalgic as I become a master programmer!
  28.  
  29.     //Start up and welcome
  30.     //I am quite proud of my welcome box ;)
  31.     cout << " XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << endl;
  32.     cout << " X      Welcome to the Math Program          X" << endl;
  33.     cout << " X             It will find 'C'              X" << endl;
  34.     cout << " X              Let's Begin!                 X" << endl;
  35.     cout << " XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << endl;
  36.  
  37.  
  38.     int x;
  39.     int y;
  40.     int z;
  41.     int wish;
  42.  
  43.     cout << " What would you like to do? " << endl;              // These Determine
  44.     cout << " Select one :" << endl;                             // the desired opetation
  45.     cout << "   1. Addition " << endl;                           // that the user wishes to
  46.     cout << "   2. Subtraction " << endl;                        // use.
  47.     cout << "   3. Multiplication " << endl;
  48.     cout << "   4. Division " << endl;
  49.     cin >> wish;
  50.  
  51.     // The Following determines what function is being used
  52.  
  53.     if(wish == 1)                                                // For Addition, the program
  54.     {                                                            // gets the numbers then adds them
  55.         cout << " You chose Addition! " << endl;
  56.         cout << "   Please enter the First Number: ";
  57.         cin >> x;
  58.         cout << "           Number 1 = " << x << endl;
  59.         cout << "   Please enter the Second Number: ";
  60.         cin >> y;
  61.         cout << "           Number 2 = " << y << endl;
  62.  
  63.  
  64.  
  65.         cout << "    The sum of the two numbers is " << z << endl;
  66.  
  67.     }
Add Comment
Please, Sign In to add comment