Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- the header file is addition.h
- below is header
- --------------------------
- #ifndef addition.h
- #define addition.h
- int add(int x, int y)
- {
- return x + y
- }
- #endif // addition.h
- Below is the main
- --------------------------
- #include <iostream>
- #include "addition.h"
- using namespace std;
- int main()
- {
- // This is like my first program ever. Woot.
- // Hopefully this becomes ever so nostalgic as I become a master programmer!
- //Start up and welcome
- //I am quite proud of my welcome box ;)
- cout << " XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << endl;
- cout << " X Welcome to the Math Program X" << endl;
- cout << " X It will find 'C' X" << endl;
- cout << " X Let's Begin! X" << endl;
- cout << " XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << endl;
- int x;
- int y;
- int z;
- int wish;
- cout << " What would you like to do? " << endl; // These Determine
- cout << " Select one :" << endl; // the desired opetation
- cout << " 1. Addition " << endl; // that the user wishes to
- cout << " 2. Subtraction " << endl; // use.
- cout << " 3. Multiplication " << endl;
- cout << " 4. Division " << endl;
- cin >> wish;
- // The Following determines what function is being used
- if(wish == 1) // For Addition, the program
- { // gets the numbers then adds them
- cout << " You chose Addition! " << endl;
- cout << " Please enter the First Number: ";
- cin >> x;
- cout << " Number 1 = " << x << endl;
- cout << " Please enter the Second Number: ";
- cin >> y;
- cout << " Number 2 = " << y << endl;
- cout << " The sum of the two numbers is " << z << endl;
- }
Add Comment
Please, Sign In to add comment