-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
antony-frolov
committed
Mar 3, 2022
1 parent
1bad79b
commit 2d869af
Showing
5 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <unistd.h> | ||
|
||
int main(int argc, char *argv[]){ | ||
int a; | ||
scanf("%d", &a); | ||
int n = atoi(argv[1]); | ||
n = n + 1 + a; | ||
printf("%d\n",n); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include <stdlib.h> | ||
|
||
int main() { | ||
exit(1); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include <stdlib.h> | ||
|
||
int main() { | ||
exit(0); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include <string.h> | ||
#include <stdlib.h> | ||
#include <stdio.h> | ||
#include <unistd.h> | ||
#define MAX_STR_LEN 100 | ||
int main(int argc, char *argv[]) { | ||
// FILE *my_file = fopen("output1.txt", "w"); | ||
int console_arg = atoi(argv[1]); | ||
char input_str[MAX_STR_LEN]; | ||
read(0, input_str, MAX_STR_LEN); | ||
fprintf(my_file, "%s\n", input_str); | ||
int input_arg = atoi(input_str); | ||
input_arg += 1; | ||
input_arg += console_arg; | ||
char output_str[MAX_STR_LEN]; | ||
sprintf(output_str, "%d\n", input_arg); | ||
write(1, output_str, strlen(output_str)); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include <string.h> | ||
#include <stdlib.h> | ||
#include <stdio.h> | ||
#include <unistd.h> | ||
#define MAX_STR_LEN 100 | ||
int main(int argc, char *argv[]) { | ||
FILE *my_file = fopen("output2.txt", "w"); | ||
int console_arg = atoi(argv[1]); | ||
char input_str[MAX_STR_LEN]; | ||
read(0, input_str, MAX_STR_LEN); | ||
int input_arg = atoi(input_str); | ||
input_arg += 2; | ||
input_arg += console_arg; | ||
char output_str[MAX_STR_LEN]; | ||
sprintf(output_str, "%d\n", input_arg); | ||
// printf("%d", input_arg); | ||
fprintf(my_file, "%s\n", output_str); | ||
write(1, output_str, strlen(output_str)); | ||
// char my_eof = EOF; | ||
// write(1, &my_eof, 1); | ||
return 0; | ||
} |