Bugfix & Makefile
This commit is contained in:
parent
244862feea
commit
420b78bdc2
8
Makefile
Normal file
8
Makefile
Normal file
@ -0,0 +1,8 @@
|
||||
files = add div mean mul sub sum
|
||||
|
||||
all: $(files)
|
||||
|
||||
$(files): %: %.c
|
||||
|
||||
clean:
|
||||
rm -v $(files)
|
4
add.c
4
add.c
@ -13,10 +13,10 @@ int main(int argc, char **argv) {
|
||||
e1 = sscanf(argv[1], "%i", &v1);
|
||||
e2 = sscanf(argv[2], "%i", &v2);
|
||||
if(e1==EOF) {
|
||||
eprintf("%s: argument %d cannot be parsed as int", *argv);
|
||||
eprintf("%s: argument 1 cannot be parsed as int", *argv);
|
||||
return 1;
|
||||
} else if(e2==EOF) {
|
||||
eprintf("%s: argument %d cannot be parsed as int", *argv);
|
||||
eprintf("%s: argument 2 cannot be parsed as int", *argv);
|
||||
return 1;
|
||||
}
|
||||
out=v1+v2;
|
||||
|
4
div.c
4
div.c
@ -13,10 +13,10 @@ int main(int argc, char **argv) {
|
||||
e1 = sscanf(argv[1], "%i", &v1);
|
||||
e2 = sscanf(argv[2], "%i", &v2);
|
||||
if(e1==EOF) {
|
||||
eprintf("%s: argument %d cannot be parsed as int", *argv);
|
||||
eprintf("%s: argument 1 cannot be parsed as int", *argv);
|
||||
return 1;
|
||||
} else if(e2==EOF) {
|
||||
eprintf("%s: argument %d cannot be parsed as int", *argv);
|
||||
eprintf("%s: argument 2 cannot be parsed as int", *argv);
|
||||
return 1;
|
||||
}
|
||||
out=v1/v2;
|
||||
|
4
mul.c
4
mul.c
@ -13,10 +13,10 @@ int main(int argc, char **argv) {
|
||||
e1 = sscanf(argv[1], "%i", &v1);
|
||||
e2 = sscanf(argv[2], "%i", &v2);
|
||||
if(e1==EOF) {
|
||||
eprintf("%s: argument %d cannot be parsed as int", *argv);
|
||||
eprintf("%s: argument 1 cannot be parsed as int", *argv);
|
||||
return 1;
|
||||
} else if(e2==EOF) {
|
||||
eprintf("%s: argument %d cannot be parsed as int", *argv);
|
||||
eprintf("%s: argument 2 cannot be parsed as int", *argv);
|
||||
return 1;
|
||||
}
|
||||
out=v1*v2;
|
||||
|
4
sub.c
4
sub.c
@ -13,10 +13,10 @@ int main(int argc, char **argv) {
|
||||
e1 = sscanf(argv[1], "%i", &v1);
|
||||
e2 = sscanf(argv[2], "%i", &v2);
|
||||
if(e1==EOF) {
|
||||
eprintf("%s: argument %d cannot be parsed as int", *argv);
|
||||
eprintf("%s: argument 1 cannot be parsed as int", *argv);
|
||||
return 1;
|
||||
} else if(e2==EOF) {
|
||||
eprintf("%s: argument %d cannot be parsed as int", *argv);
|
||||
eprintf("%s: argument 2 cannot be parsed as int", *argv);
|
||||
return 1;
|
||||
}
|
||||
out=v1-v2;
|
||||
|
Loading…
Reference in New Issue
Block a user