1. Valentine Svensson
  2. MATM17

Commits

Valentine Svensson  committed df108da

Started on multiplication.

  • Participants
  • Parent commits 2328eac
  • Branches ES3

Comments (0)

Files changed (1)

File ES3/fractions.c

View file
  • Ignore whitespace
     double approx;
 };
 
+void approximate(struct fraction *in_frac)
+{
+    in_frac->approx = (double)in_frac->num/(double)in_frac->denom;
+}
+
 void read_frac(struct fraction *in_frac)
 {
     printf("Type in a fraction (e.g. '1/2'):\n");
-    scanf("%i/%i", &(*in_frac).num, &(*in_frac).denom);
+    scanf("%i/%i", &in_frac->num, &in_frac->denom);
+    approximate(in_frac);
+}
+
+void frac_mult(const struct fraction *f1, const struct fraction *f2,
+    struct fraction *p2)
+{
+    
 }
 
 int main(int argc, char const *argv[])