Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

subtraction function #4

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
7 changes: 7 additions & 0 deletions fall-22-cs1c-demo-cpp.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"folders": [
{
"path": "."
}
]
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is generated by VSCode and should only be local to your machine. I'd suggest adding this file into .gitignore. So for your next commit, it will ignore this file upon committing.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. Fix this then we can merge

4 changes: 4 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

//import necessary files
#include "addNumbers.h"
#include "subtractNumbers.h"

// Function: main
int main()
Expand All @@ -14,6 +15,9 @@ int main()
//now call add number x times function
addNumberXTimes(3, 10);

//now call subtract numbers function
subtractNumbers(9,7);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

// Exits the program
return 0;
}
7 changes: 7 additions & 0 deletions subtractNumbers.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <iostream>
using namespace std;

void subtractNumbers(int num1, int num2)
{
cout << num1 << " - " << num2 << " = " << num1-num2 << endl;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, though I'd pollute your function with documentation just because 😎