<commit_before>// CS 539, HW 5B Array, <NAME>

#include <stdio.h>
#include <stdlib.h>

void show( const double a[], unsigned elements );
double sum( const double a[], unsigned elements );
void half( double a[], unsigned elements );
void add( double result[], const double a0[], const double a1[], unsigned elements );
void maximum( double result[], const double a0[], const double a1[], unsigned elements );
void stat( double * smallest, double * average, double * largest, const double a[], unsigned elements );
void setFib( unsigned result[], unsigned elements );
void reverse( double a[], unsigned elements );
int die( const char msg[] );

int main(){
    double a[] = {1.1, 2.2, 3.3, 4.4};
    double b[] = {2, 4, 6};
    double c[] = {1, 2, 3};
    unsigned i = 0;
    unsigned elements = 3;
    
    show(a, 4);
    
    printf("Sum = %lf\n", sum(a, 4));
    printf("Sum = %lf\n", sum(b, 3));
    
    half(c, elements);
    printf("Half = {");
    for (i; i < elements; ++i){
        printf("%lf", c[i]);
        if (i < elements - 1) printf(", ");
    }
    printf("}\n");
    
    return 0;
}
void show( const double a[], unsigned elements ){
    unsigned i = 0;
    
    printf("{");
    for (i; i < elements; ++i){
        printf("%lf", a[i]);
        if (i < elements - 1) printf(", ");
    }
    printf("}\n");
}
double sum( const double a[], unsigned elements ){
    double retVal = 0;
    unsigned i = 0;
    
    for (i; i < elements; ++i) retVal += a[i];
    return retVal;
}
void half( double a[], unsigned elements ){
    unsigned i = 0;
    
    for (i; i < elements; ++i) a[i] = a[i] / 2;
}
void add( double result[], const double a0[], const double a1[], unsigned elements ){
    
}
void maximum( double result[], const double a0[], const double a1[], unsigned elements ){
    
}
void stat( double * smallest, double * average, double * largest, const double a[], unsigned elements ){
    
}
void setFib( unsigned result[], unsigned elements ){
    
}
void reverse( double a[], unsigned elements ){
    
}
int die( const char msg[] ){
    printf("Fatal error: %s", msg);
    exit(EXIT_FAILURE);
}<commit_msg>Stopped at adding two arrays.<commit_after>// CS 539, HW 5B Array, <NAME>

#include <stdio.h>
#include <stdlib.h>

void show( const double a[], unsigned elements );
double sum( const double a[], unsigned elements );
void half( double a[], unsigned elements );
void add( double result[], const double a0[], const double a1[], unsigned elements );
void maximum( double result[], const double a0[], const double a1[], unsigned elements );
void stat( double * smallest, double * average, double * largest, const double a[], unsigned elements );
void setFib( unsigned result[], unsigned elements );
void reverse( double a[], unsigned elements );
int die( const char msg[] );

int main(){
    double a[] = {1.1, 2.2, 3.3, 4.4};
    double b[] = {2, 4, 6};
    double c[] = {1, 2, 3};
    double result[3] = {};
    unsigned i = 0;
    unsigned elements = 3;
    
    show(a, 4);
    
    printf("sum = %lf\n", sum(a, 4));
    printf("sum = %lf\n", sum(b, 3));
    
    half(a, elements);
    printf("half = {");
    for (i; i < elements; ++i){
        printf("%lf", a[i]);
        if (i < elements - 1) printf(", ");
    }
    printf("}\n");
    
    add(result, b, c, elements);
    printf("add = {");
    for (i; i < elements; ++i){
        printf("%lf", result[i]);
        if (i < elements - 1) printf(", ");
    }
    printf("}\n");
    
    return 0;
} //int main()

void show( const double a[], unsigned elements ){
    unsigned i = 0;
    
    printf("{");
    for (i; i < elements; ++i){
        printf("%lf", a[i]);
        if (i < elements - 1) printf(", ");
    }
    printf("}\n");
}
double sum( const double a[], unsigned elements ){
    double retVal = 0;
    unsigned i = 0;
    
    for (i; i < elements; ++i) retVal += a[i];
    return retVal;
}
void half( double a[], unsigned elements ){
    unsigned i = 0;
    
    for (i; i < elements; ++i) a[i] = a[i] / 2;
}
void add( double result[], const double a0[], const double a1[], unsigned elements ){
    unsigned i = 0;
    
    for (i; i < elements; ++i) result[i] = a0[i] + a1[i];
    
    // i = 0;
    // for (i; i < elements; ++i) printf("%lf\n", result[i]);
}
void maximum( double result[], const double a0[], const double a1[], unsigned elements ){
    
}
void stat( double * smallest, double * average, double * largest, const double a[], unsigned elements ){
    
}
void setFib( unsigned result[], unsigned elements ){
    
}
void reverse( double a[], unsigned elements ){
    
}
int die( const char msg[] ){
    printf("Fatal error: %s", msg);
    exit(EXIT_FAILURE);
}
{'fraction_non_alphanumeric': 0.17851027397260275, 'fraction_numerical': 0.01797945205479452, 'mean_word_length': 2.839769926047658, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6083974', 'n_tokens_mistral': 1553, 'n_tokens_neox': 1538, 'n_words': 564}