forked from atclarkson/CS50
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit add
More file actions
128 lines (128 loc) · 4.38 KB
/
git add
File metadata and controls
128 lines (128 loc) · 4.38 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
[1mdiff --git a/pset1/cash/cash.c b/pset1/cash/cash.c[m
[1mdeleted file mode 100644[m
[1mindex c17f481..0000000[m
[1m--- a/pset1/cash/cash.c[m
[1m+++ /dev/null[m
[36m@@ -1,51 +0,0 @@[m
[31m-#include <stdio.h>[m
[31m-#include <cs50.h>[m
[31m-#include <math.h>[m
[31m-[m
[31m-int main(void)[m
[31m-{[m
[31m- /* Prompt User for the amount of change owed */[m
[31m- float userchange = get_float("Change owed: ");[m
[31m- //Check that number is positve[m
[31m- while (userchange < 0.00)[m
[31m- {[m
[31m- userchange = get_float("Change owed: ");[m
[31m- }[m
[31m- //Cast Float to an int[m
[31m- userchange *= 100;[m
[31m- //printf("%f", round(userchange));[m
[31m- userchange = round(userchange);[m
[31m- int change = (int)userchange;[m
[31m- //Declare counter variable to keep track of how many coins are returned[m
[31m- int counter = 0;[m
[31m- //printf("counter is now %i, and remaining money is %i\n", counter, change);[m
[31m- // Quarter loop[m
[31m- while (change >= 25)[m
[31m- {[m
[31m- change -= 25;[m
[31m- counter++;[m
[31m- //printf("gave back a quarter, total change is now %i, and remaining money is %i\n", counter, change);[m
[31m- }[m
[31m- // Dime loop[m
[31m- while (change >= 10)[m
[31m- {[m
[31m- change -= 10;[m
[31m- counter++;[m
[31m- //printf("gave back a dime, total change is now %i, and remaining money is %i\n", counter, change);[m
[31m- }[m
[31m- // Nickle loop[m
[31m- while (change >= 5)[m
[31m- {[m
[31m- change -= 5;[m
[31m- counter++;[m
[31m- //printf("gave back a nickle, total change is now %i, and remaining money is %i\n", counter, change);[m
[31m- }[m
[31m- // Penny loop[m
[31m- while (change >= 1)[m
[31m- {[m
[31m- change -= 1;[m
[31m- counter++;[m
[31m- //printf("gave back a penny, total change is now %i, and remaining money is %i\n", counter, change);[m
[31m- }[m
[31m- printf("%i\n", counter); //print out total number of coins as change.[m
[31m-}[m
\ No newline at end of file[m
[1mdiff --git a/pset1/hello/hello.c b/pset1/hello/hello.c[m
[1mdeleted file mode 100644[m
[1mindex 68aa39a..0000000[m
[1m--- a/pset1/hello/hello.c[m
[1m+++ /dev/null[m
[36m@@ -1,7 +0,0 @@[m
[31m-#include <stdio.h>[m
[31m-[m
[31m-int main(void)[m
[31m-{[m
[31m- //Print hello world to the screen[m
[31m- printf("hello, world\n");[m
[31m-}[m
[1mdiff --git a/pset1/mario/more/mario.c b/pset1/mario/more/mario.c[m
[1mdeleted file mode 100644[m
[1mindex c545d74..0000000[m
[1m--- a/pset1/mario/more/mario.c[m
[1m+++ /dev/null[m
[36m@@ -1,39 +0,0 @@[m
[31m-#include <stdio.h>[m
[31m-#include <cs50.h>[m
[31m-[m
[31m-int main(void)[m
[31m-{[m
[31m- //Ask user for a number between 1 and 23[m
[31m- int height = get_int("Height: ");[m
[31m- //Check user input to verify it is less than 24[m
[31m- while (height > 23)[m
[31m- {[m
[31m- height = get_int("Height: ");[m
[31m- }[m
[31m- while (height < 0)[m
[31m- {[m
[31m- height = get_int("Height: ");[m
[31m- }[m
[31m- //Loop to print pyramids on screen[m
[31m- //Loop to move through rows[m
[31m- for (int row = 1; row <= height; row++)[m
[31m- {[m
[31m- // Loop to print spaces[m
[31m- for (int i = 0; i < (height - row); i++)[m
[31m- {[m
[31m- printf(" ");[m
[31m- }[m
[31m- // loop to print hashes[m
[31m- for (int i = 0; i < (row); i++)[m
[31m- {[m
[31m- printf("#");[m
[31m- }[m
[31m- printf(" "); // create 2 spaces for chasim[m
[31m- // loop to print other side of pyramid[m
[31m- for (int i = 0; i < (row); i++)[m
[31m- {[m
[31m- printf("#");[m
[31m- }[m
[31m- printf("\n"); // new line at end of row[m
[31m- }[m
[31m-}[m
\ No newline at end of file[m
[1mdiff --git a/pset2/caesar/caesar.c b/pset2/caesar/caesar.c[m
[1mindex 2a4e27a..614399a 100644[m
[1m--- a/pset2/caesar/caesar.c[m
[1m+++ b/pset2/caesar/caesar.c[m
[36m@@ -47,4 +47,5 @@[m [mint main (int argc, string argv[])[m
}[m
}[m
printf("\n");[m
[32m+[m[32m return 1;[m
}[m
\ No newline at end of file[m