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

swpp 2018 git quiz #1

Closed
ssm0318 opened this issue Jan 7, 2020 · 1 comment
Closed

swpp 2018 git quiz #1

ssm0318 opened this issue Jan 7, 2020 · 1 comment

Comments

@ssm0318
Copy link
Owner

ssm0318 commented Jan 7, 2020

SWPP2018 Git Quiz
There are two branches, master branch and add branch, on this repository. The master branch contains a skeleton code for a calculator (the same one as the assignment), and the add branch contains the skeleton code and the implementation of add function. You will make two pull requests, one for the master branch and one for the add branch.

STEP 1
Fork this repository and clone the fork into your local machine.
Make a new branch calc1 from the master branch and checkout to it.
Implement add, sub, and mul function, while making one commit for each function. This means, you should make three commits in total.
Push your branch into origin repository and make a pull request to the master branch of the upstream repository(this repository) from your calc1 branch.
STEP2
Checkout to a new branch calc2 from the calc1 branch.
Squash the three commits you have made and push it into the calc2 branch of your fork.
Since add function is already implemented in the add branch, there will be a conflict between the add branch and calc2 branch.
Resolve the conflict and make a pull request to the add branch of the upstream repository from your calc2 branch.
NOTE
Note that the two pull requests should not contain any conflicts after you finish all the steps.

@ssm0318
Copy link
Owner Author

ssm0318 commented Jan 7, 2020

#include <stdio.h>

int add(int a, int b);
int sub(int a, int b);
int mul(int a, int b);

int main(){

int n, m;
char op;

while(1){
scanf("%d %c %d", &n, &op, &m);
switch(op) {
case '+' : printf("%d %c %d = %d\n", n, op, m, add(n, m)); return 0;
case '-' : printf("%d %c %d = %d\n", n, op, m, sub(n, m)); return 0;
case '*' : printf("%d %c %d = %d\n", n, op, m, mul(n, m)); return 0;
default : printf("invalid input\n"); break;
}
}

return 0;
}

int add(int a, int b) {
return 0; // TODO : FIX IT
}

int sub(int a, int b) {
return 0; // TODO : FIX IT
}

int mul(int a, int b) {
return 0; // TODO : FIX IT
}

@ssm0318 ssm0318 closed this as completed Oct 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant