# 10016. Structure - Fraction

## 題目描述

gcc main.c fraction.c -std=c99 -O2


### main.c

123456789101112131415161718192021#include <stdio.h>#include "fraction.h" int main() {    int cmd, x, y, z, w;    Frac a, b, c;    scanf("%d", &cmd);    scanf("%d %d %d %d", &x, &y, &z, &w);    a = normal(x, y), b = normal(z, w);    if (cmd == 1) {        c = add(a, b);    } else if (cmd == 2) {        c = subtract(a, b);    } else if (cmd == 3) {        c = multipy(a, b);    } else if (cmd == 4) {        c = divide(a, b);    }    printf("%lld / %lld\n", c.a, c.b);    return 0;}


### fraction.h

12345678typedef struct {    long long a, b;} Frac;Frac normal(long long, long long);Frac add(Frac, Frac);Frac subtract(Frac, Frac);Frac multipy(Frac, Frac);Frac divide(Frac, Frac);


### fraction.c

1234567891011121314151617#include "fraction.h" Frac normal(long long a, long long b) {    /* add your code */}Frac add(Frac x, Frac y) {    /* add your code */}Frac subtract(Frac x, Frac y) {    /* add your code */}Frac multipy(Frac x, Frac y) {    /* add your code */}Frac divide(Frac x, Frac y) {    /* add your code */}


## Sample Input

10 1 50 30


## Sample Output

5 / 3