diff --git a/assignment8.txt b/assignment8.txt new file mode 100644 index 0000000..541ce08 --- /dev/null +++ b/assignment8.txt @@ -0,0 +1,21 @@ +Emma Ladouceur + +//This is most likely incorrect because I didn't really understand the memory leaks, but I looked up a bunch of stuff + + +1. +abcabc1 +abc1 +abc123 + +2. +I think it's 0 but i'm not sure + + +3. +NONE + + +4. + +NO CHANGE diff --git a/inout.c b/inout.c new file mode 100644 index 0000000..0ce7a6b --- /dev/null +++ b/inout.c @@ -0,0 +1,42 @@ +//Emma Ladouceur + +#include +#include +#include +int main(){ +FILE *inFile = fopen("inout.txt", "r"); + + +char inout[100]; + +float a; + +fgets(inout, sizeof(inout), inFile); +int i; +float total, mean, sumsquare, std; +for(i = 0; i<=9; i++){ + +a = atof(inout); +printf("%f\n", a); +fgets(inout, 100, inFile); + +total = total + a; + +} +int numarr[9]; + +mean = total/9; +for(i=0; i<9;i++){ + +sumsquare = (total-mean)*(total-mean); + +} +std = sqrt(sumsquare/i-1); + +printf("The average is: %f\n", mean); +printf("The Standard Deviation is: %f", std); +fclose(inFile); +return 0; + + +} diff --git a/inout.txt b/inout.txt new file mode 100644 index 0000000..f0acceb --- /dev/null +++ b/inout.txt @@ -0,0 +1,9 @@ +8 +7.83 +3.55 +3.78 +9.34 +5.75 +8.23 +6.66 +6.89 diff --git a/sort b/sort new file mode 100755 index 0000000..fb791f9 Binary files /dev/null and b/sort differ diff --git a/sort.c b/sort.c new file mode 100644 index 0000000..e2e21af --- /dev/null +++ b/sort.c @@ -0,0 +1,38 @@ +//Emma Ladouceur +//Hmmm... still working on this, but i'm a little confused. I have a text book that I'm going to go through and try and work on this... but below is my sort. +//Homework + +#include + +int main(){ + int i, j,a,n,array[30]; + + + printf("Enter a value for N \n"); + + scanf("%d", &n); + + + + for(i=0; i array[j]){ + a = array[i]; + array[i]=array[j]; + array[j]=a; + + + } + + } + + } + printf("The numbers are arranged in ascending order"); + for(i=0;i