-
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
1 parent
8e15c76
commit 416f263
Showing
264 changed files
with
3,331 additions
and
4,926 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,3 @@ | ||
{ | ||
"enableCMake": true | ||
} |
Binary file not shown.
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 @@ | ||
{ | ||
"version": "0.2.1", | ||
"defaults": {}, | ||
"configurations": [ | ||
{ | ||
"type": "default", | ||
"project": "CMakeLists.txt", | ||
"projectTarget": "C_primer.exe", | ||
"name": "C_primer.exe" | ||
} | ||
] | ||
} |
Binary file added
BIN
+15.8 KB
.vs/learn_c_primer.github.io/FileContentIndex/14f55a87-a27b-482a-9aff-53f9d21869db.vsidx
Binary file not shown.
Binary file removed
BIN
-5.3 KB
.vs/learn_c_primer.github.io/FileContentIndex/1d4ec389-4f90-422f-a904-ac62d9602018.vsidx
Binary file not shown.
Binary file removed
BIN
-912 KB
.vs/learn_c_primer.github.io/FileContentIndex/66f8a618-d83e-4371-86a0-007c40188683.vsidx
Binary file not shown.
Binary file removed
BIN
-6.3 KB
.vs/learn_c_primer.github.io/FileContentIndex/74bce83d-0676-42fa-a97d-0e1d78579cc7.vsidx
Binary file not shown.
Binary file added
BIN
+8.14 KB
.vs/learn_c_primer.github.io/FileContentIndex/921ce8bd-09f6-46d4-814e-b0fc9f8e8b59.vsidx
Binary file not shown.
Binary file removed
BIN
-13.6 KB
.vs/learn_c_primer.github.io/FileContentIndex/95d19555-cf9a-4dc9-a3be-a783ebd22a83.vsidx
Binary file not shown.
Binary file added
BIN
+61.9 KB
.vs/learn_c_primer.github.io/FileContentIndex/a12ba736-83f9-4f30-8097-222521740032.vsidx
Binary file not shown.
Binary file added
BIN
+11.4 KB
.vs/learn_c_primer.github.io/FileContentIndex/b3783a32-0885-4410-aea1-e6e3db8da096.vsidx
Binary file not shown.
Binary file removed
BIN
-5.28 KB
.vs/learn_c_primer.github.io/FileContentIndex/c98827f8-a0dc-4802-a779-5e149176a2c4.vsidx
Binary file not shown.
Binary file added
BIN
+859 KB
.vs/learn_c_primer.github.io/FileContentIndex/eba7fb23-5976-4391-8298-e19075675971.vsidx
Binary file not shown.
1,016 changes: 1,016 additions & 0 deletions
1,016
.vs/learn_c_primer.github.io/config/applicationhost.config
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-2.94 MB
.vs/learn_c_primer.github.io/v16/ipch/AutoPCH/553a75325f793f50/13.2.ipch
Binary file not shown.
Binary file not shown.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Binary file renamed
BIN
+3.19 MB
...7/ipch/AutoPCH/553a75325f793f50/13.2.ipch → ...7/ipch/AutoPCH/14c59b3a2ea2430d/13.3.ipch
Binary file not shown.
Binary file renamed
BIN
+3.19 MB
...7/ipch/AutoPCH/4c9e14325a9bf72f/13.3.ipch → ...7/ipch/AutoPCH/1d617c3a337eb1ae/13.2.ipch
Binary file not shown.
Binary file added
BIN
+2.38 MB
.vs/learn_c_primer.github.io/v17/ipch/AutoPCH/2eb5f2e3dd4f02ff/13.12.ipch
Binary file not shown.
Binary file renamed
BIN
+2.44 MB
...7/ipch/AutoPCH/536562518f38e07c/11.6.ipch → ...7/ipch/AutoPCH/2fdc331563fed1da/9.25.ipch
Binary file not shown.
Binary file added
BIN
+2.38 MB
.vs/learn_c_primer.github.io/v17/ipch/AutoPCH/3f7364e3e69ffc15/13.10.ipch
Binary file not shown.
Binary file added
BIN
+2.38 MB
.vs/learn_c_primer.github.io/v17/ipch/AutoPCH/3fffdb2bc5a8b13e/1.ipch
Binary file not shown.
Binary file added
BIN
+3.38 MB
.vs/learn_c_primer.github.io/v17/ipch/AutoPCH/441ab78a792b877d/S_GETS.ipch
Binary file not shown.
Binary file added
BIN
+2.38 MB
.vs/learn_c_primer.github.io/v17/ipch/AutoPCH/449a49fc29b09c48/MAIN.ipch
Binary file not shown.
Binary file removed
BIN
-4.5 MB
.vs/learn_c_primer.github.io/v17/ipch/AutoPCH/44e9cb325684b8f2/13.4.ipch
Binary file not shown.
Binary file added
BIN
+2.88 MB
.vs/learn_c_primer.github.io/v17/ipch/AutoPCH/4586e0d36baa78df/13.12.ipch
Binary file not shown.
Binary file added
BIN
+2.88 MB
.vs/learn_c_primer.github.io/v17/ipch/AutoPCH/474e93a25adaf17/13.1.ipch
Binary file not shown.
Binary file added
BIN
+2.38 MB
.vs/learn_c_primer.github.io/v17/ipch/AutoPCH/480fc5e3eb7d4436/13.11.ipch
Binary file not shown.
Binary file added
BIN
+3.38 MB
.vs/learn_c_primer.github.io/v17/ipch/AutoPCH/6f8583ec8e5f024f/13.7.ipch
Binary file not shown.
Binary file added
BIN
+3.38 MB
.vs/learn_c_primer.github.io/v17/ipch/AutoPCH/782164ec933b70f0/13.6.ipch
Binary file not shown.
Binary file renamed
BIN
+2.38 MB
...7/ipch/AutoPCH/ee4a7ff7bc721bf6/13.4.ipch → ...7/ipch/AutoPCH/811c75ec9868c5a5/13.5.ipch
Binary file not shown.
Binary file added
BIN
+2.88 MB
.vs/learn_c_primer.github.io/v17/ipch/AutoPCH/82153bcd9a73751f/13.10.ipch
Binary file not shown.
Binary file renamed
BIN
+3.38 MB
...7/ipch/AutoPCH/b29d50f79aeadeeb/13.3.ipch → ...7/ipch/AutoPCH/88ded6ec9c8c6a06/13.4.ipch
Binary file not shown.
Binary file added
BIN
+2.38 MB
.vs/learn_c_primer.github.io/v17/ipch/AutoPCH/8b8a1ccda007d480/13.11.ipch
Binary file not shown.
Binary file added
BIN
+3.38 MB
.vs/learn_c_primer.github.io/v17/ipch/AutoPCH/8c4c81bd6616b05b/DOUBLECAL.ipch
Binary file not shown.
Binary file added
BIN
+2.38 MB
.vs/learn_c_primer.github.io/v17/ipch/AutoPCH/9485adcda53602b5/13.12.ipch
Binary file not shown.
Binary file added
BIN
+3.38 MB
.vs/learn_c_primer.github.io/v17/ipch/AutoPCH/9fe2ae5cd1cfaffd/DOUBLECAL.ipch
Binary file not shown.
Binary file renamed
BIN
+3.13 MB
...7/ipch/AutoPCH/c2ed82f7a3de9961/13.1.ipch → ...7/ipch/AutoPCH/a37051ecabc29af9/13.9.ipch
Binary file not shown.
Binary file added
BIN
+3.38 MB
.vs/learn_c_primer.github.io/v17/ipch/AutoPCH/ab44a3de35a2069d/DOUBLECAL.ipch
Binary file not shown.
Binary file added
BIN
+3.38 MB
.vs/learn_c_primer.github.io/v17/ipch/AutoPCH/ac5f647893ba03af/13.7.ipch
Binary file not shown.
Binary file renamed
BIN
+3.38 MB
...7/ipch/AutoPCH/ba5f31f79f0da9cc/13.2.ipch → ...7/ipch/AutoPCH/ac7972ecb0fc483a/13.8.ipch
Binary file not shown.
Binary file renamed
BIN
+3.44 MB
.../ipch/AutoPCH/9f4643a86c9665fa/11.42.ipch → ...7/ipch/AutoPCH/b4fbc57898974bd0/13.6.ipch
Binary file not shown.
Binary file added
BIN
+3.38 MB
.vs/learn_c_primer.github.io/v17/ipch/AutoPCH/baa36d893d2d6e7/S_GETS.ipch
Binary file not shown.
Binary file added
BIN
+2.88 MB
.vs/learn_c_primer.github.io/v17/ipch/AutoPCH/be19b139fd87966f/13.9.ipch
Binary file not shown.
Binary file added
BIN
+2.88 MB
.vs/learn_c_primer.github.io/v17/ipch/AutoPCH/c6b5123a02632b90/13.8.ipch
Binary file not shown.
Binary file added
BIN
+2.88 MB
.vs/learn_c_primer.github.io/v17/ipch/AutoPCH/c76bb778a358ffe6/13.4.ipch
Binary file not shown.
Binary file added
BIN
+2.88 MB
.vs/learn_c_primer.github.io/v17/ipch/AutoPCH/cc238fd233ad7ed4/6.11.ipch
Binary file not shown.
Binary file renamed
BIN
+2.94 MB
...7/ipch/AutoPCH/5e35863264a69405/13.1.ipch → ...7/ipch/AutoPCH/e1b44d3a11f774a3/13.5.ipch
Binary file not shown.
Binary file added
BIN
+2.88 MB
.vs/learn_c_primer.github.io/v17/ipch/AutoPCH/e976ae3a161b1904/13.4.ipch
Binary file not shown.
Binary file renamed
BIN
+3.44 MB
.../ipch/AutoPCH/770258b7bba177d9/11.25.ipch → ...7/ipch/AutoPCH/f2047f3a1aeb2f19/13.7.ipch
Binary file not shown.
Binary file added
BIN
+3.38 MB
.vs/learn_c_primer.github.io/v17/ipch/AutoPCH/fb0d203a202402da/13.6.ipch
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
#include <stdio.h> | ||
|
||
int main() { | ||
int main(void) | ||
{ | ||
printf("Hello, World!\n"); | ||
|
||
return 0; | ||
} |
Binary file not shown.
Binary file not shown.
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
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,38 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
int main (int argc, char * argv[]) | ||
{ | ||
int ch; | ||
FILE * fp; | ||
unsigned long count =0; | ||
|
||
if (argc != 2) | ||
{ | ||
printf ("usage: %s filename\n", argv[0]); | ||
exit (EXIT_FAILURE); | ||
} | ||
else; | ||
|
||
if (!(fp = fopen(argv[1], "r"))) | ||
{ | ||
printf ("can't open %s\n", argv[1]); | ||
exit (EXIT_FAILURE); | ||
} | ||
else; | ||
|
||
while ((ch = getc(fp)) != EOF) | ||
{ | ||
putc (ch, stdout); | ||
count ++; | ||
} | ||
|
||
if (fclose(fp)) | ||
{ | ||
printf("error in closing file %s\n", argv[1]); | ||
} | ||
else; | ||
|
||
printf ("file %s has %lu characters\n", argv[1], count); | ||
|
||
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,18 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
int main(void) | ||
{ | ||
FILE* fp; | ||
int k; | ||
|
||
fp = fopen("test1310", "w+"); | ||
|
||
for (k = 0; k < 30; k++) | ||
{ | ||
fputs("Nanette eats geldtin. \n", fp); | ||
} | ||
|
||
fclose(fp); | ||
|
||
return 0; | ||
} |
Binary file not shown.
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,45 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
int main(int argc, char* argv[]) { | ||
FILE* fp; | ||
double ret = 0, num; | ||
int cot = 0; | ||
|
||
if (argc == 2) | ||
{ | ||
if ((fp = fopen(argv[1], "r")) == NULL) | ||
{ | ||
printf("wrong in opening %s. \n", argv[1]); | ||
exit(EXIT_FAILURE); | ||
} | ||
} | ||
else if (argc == 1) | ||
{ | ||
fp = stdin; | ||
printf("please enter numbers, q to quit: \n"); | ||
} | ||
else | ||
{ | ||
printf("fullstop. \n"); | ||
exit(EXIT_FAILURE); | ||
} | ||
|
||
while (fscanf(fp, "%lf", &num) == 1) | ||
{ | ||
ret += num; | ||
cot++; | ||
} | ||
|
||
if (cot != 0) | ||
{ | ||
ret /= cot; | ||
printf("%lf\n", ret); | ||
} | ||
else | ||
{ | ||
printf("No numbers read.\n"); | ||
} | ||
|
||
fclose(fp); | ||
return 0; | ||
} |
Binary file not shown.
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,76 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
int main(int argc, char * argv[]) | ||
{ | ||
char ch, buf[256]; | ||
FILE* fp1; | ||
|
||
if (argc < 3) | ||
{ | ||
printf("handle failure. \n"); | ||
exit(EXIT_FAILURE); | ||
} | ||
else; | ||
|
||
if ((fp1 = fopen(argv[2], "r")) == NULL) | ||
{ | ||
printf("open %s failure. \n", argv[2]); | ||
exit(EXIT_FAILURE); | ||
} | ||
else; | ||
|
||
ch = argv[1][0]; | ||
setvbuf(fp1, buf, _IOLBF, sizeof(buf)); | ||
|
||
while (fgets(buf, 256, fp1)) | ||
{ | ||
for (int i = 0; buf[i] != '\0'; i ++) | ||
{ | ||
if (buf[i] == ch) | ||
{ | ||
fputs(buf, stdout); | ||
break; | ||
} | ||
} | ||
} | ||
|
||
fclose(fp1); | ||
return 0; | ||
} | ||
|
||
/* | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
int main(int argc, char* argv[]) { | ||
char ch, buf[256]; | ||
FILE* fp1; | ||
if (argc < 3) { | ||
printf("Usage: %s filename character\n", argv[0]); | ||
exit(EXIT_FAILURE); | ||
} | ||
fp1 = fopen(argv[2], "r"); | ||
if (fp1 == NULL) { | ||
printf("Failed to open %s\n", argv[1]); | ||
exit(EXIT_FAILURE); | ||
} | ||
ch = argv[1][0]; | ||
setvbuf(fp1, buf, _IOLBF, sizeof(buf)); | ||
while (fgets(buf, sizeof(buf), fp1)) { | ||
for (int i = 0; buf[i] != '\n'; i++) { | ||
if (buf[i] == ch) { | ||
fputs(buf, stdout); | ||
break; | ||
} | ||
} | ||
} | ||
fclose(fp1); | ||
return 0; | ||
} | ||
*/ |
Binary file not shown.
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,35 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
int main (void) | ||
{ | ||
int ch; | ||
FILE * fp; | ||
unsigned long count = 0; | ||
char str[50]; | ||
|
||
printf ("please enter file's name: \n"); | ||
scanf ("%s", str); | ||
|
||
if (!(fp = fopen(str, "r"))) | ||
{ | ||
printf ("can't open %s\n", str); | ||
exit (EXIT_FAILURE); | ||
} | ||
else; | ||
|
||
while ((ch = getc(fp)) != EOF) | ||
{ | ||
putc (ch, stdout); | ||
count ++; | ||
} | ||
|
||
if (fclose(fp)) | ||
{ | ||
printf ("error in closing file %s\n", str); | ||
} | ||
else; | ||
|
||
printf ("file %s has %lu characters\n", str, count); | ||
|
||
return 0; | ||
} |
Binary file not shown.
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,30 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
int main (int argc, char * argv[]) | ||
{ | ||
FILE * fp1, * fp2; | ||
|
||
if (argc != 3) | ||
{ | ||
printf ("negative enter. \n"); | ||
exit (EXIT_FAILURE); | ||
}else; | ||
|
||
if ((fp1 = fopen (argv[1], "r")) == NULL) | ||
{ | ||
printf("error opening %s. \n", argv[1]); | ||
exit(EXIT_FAILURE); | ||
}else; | ||
|
||
if ((fp2 = fopen (argv[2], "w")) == NULL) | ||
{ | ||
printf("error opening %s. \n", argv[2]); | ||
exit(EXIT_FAILURE); | ||
}else; | ||
|
||
for (char ch; (ch = getc(fp1)) != EOF; putc(ch, fp2)); | ||
|
||
fclose (fp1); | ||
fclose (fp2); | ||
return 0; | ||
} |
Binary file not shown.
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,32 @@ | ||
#include <stdio.h> | ||
#include <ctype.h> | ||
#include <stdlib.h> | ||
int main (void) | ||
{ | ||
FILE * fp1, * fp2; | ||
char f_name_1[50], f_name_2[50]; | ||
|
||
printf ("this program turns lower into upper. \n"); | ||
printf ("please enter the first file name: \n"); | ||
scanf ("%s", f_name_1); | ||
printf ("now enter the second file name: \n"); | ||
scanf ("%s", f_name_2); | ||
|
||
if ((fp1 = fopen (f_name_1, "r")) == NULL) | ||
{ | ||
printf("error opening %s. \n", f_name_1); | ||
exit(EXIT_FAILURE); | ||
}else; | ||
|
||
if ((fp2 = fopen (f_name_2, "w")) == NULL) | ||
{ | ||
printf("error opening %s. \n", f_name_2); | ||
exit(EXIT_FAILURE); | ||
}else; | ||
|
||
for (char ch; (ch = getc (fp1)) != EOF; islower (ch) ? putc (toupper (ch), fp2): putc (ch, fp2)); | ||
|
||
fclose (fp1); | ||
fclose (fp2); | ||
return 0; | ||
} |
Binary file not shown.
Oops, something went wrong.