-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasics.c
More file actions
92 lines (92 loc) · 2.23 KB
/
basics.c
File metadata and controls
92 lines (92 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
//
// Created by Ethan Sawyer on 7/5/20.
//
//#include <stdio.h>
//
//void printStars(int n) {
// for (int i = 1; i <= n; i++) {
// printf("*");
// }
//}
//
//float ftok(float degf) {
// return 5.0 / 9.0 * (degf - 32) + 273.15;
//}
//
//// Takes two filenames as parameters and copies the
//// contents of the file with the first name into a
//// file with the second name (creating it if it doesn’t
//// exist, overwriting it if it does exist, both of
//// which are the default behavior of fopen).
//int copyfile(char *srcfilename, char *dstfilename) {
// FILE *src = fopen(srcfilename, "r");
// if (src == NULL) {
// return 0;
// }
// FILE *dst = fopen(dstfilename, "w");
// if (dst == NULL) {
// return 0;
// }
// while (!feof(src)) {
// char str[256];
// if (fgets(str, 255, src) != NULL) {
// fprintf(dst, "%s", str);
// }
// }
// fclose(src);
// fclose(dst);
// return 1;
//}
//
//int main(int argc, char *argv[]) {
//
// double degreesF = 212.0;
// double kelvins = 5.0 / 9.0 * (degreesF - 32) + 273.15;
// printf("%f degrees Fahrenheit is %f Kelvins\n", degreesF, kelvins);
//
// if (degreesF <= 32.0) {
// printf("That's freezing!\n");
// } else if (degreesF >= 212.0) {
// printf("That's boiling!\n");
// } else {
// printf("That's nice.\n");
// }
//
// int i = 1;
// while (i <= 10) {
// printf("%d\n", i);
// i += 1;
// }
//
// for (int j = 10; j >= 1; j -= 2) {
// printf("%d\n", j);
// }
//
// printStars(5);
// printf("\n");
//
// printf("0 degrees F is %f Kelvins\n", ftok(0.0));
//
// int n;
// printf("Enter an integer: ");
// scanf("%d", &n);
// printf("You entered %d\n", n);
//
// float f;
// printf("Enter a floating-point number: ");
// scanf("%f", &f);
// printf("You entered %f\n", f);
//
// char str[256];
// printf("Enter a string (no more than 255 characters): ");
// scanf("%255s", str);
// printf("You entered \"%s\"\n", str);
//
// //TODO: fix lines 60-64
// printf("Enter lines of text; blank line to finish:\n");
// do {
// fgets(str, 255, stdin);
// printf("%s", str);
// } while (str[0] != '\n');
//
//}