Rational Number (1)

  1. Suppose you have defined a struct:
    struct Rational {
        int numerator;      // 分子
        int denominator;    // 分母
    };
  2. Create a program which can read 5 rational numbers, and then print them out.
  3. The program may run as follows:
    1/5
    2/4
    3/3
    4/2
    5/1
    1/5 2/4 3/3 4/2 5/1
  4. The main function may look like:
    int main()
    {
        Rational A[N];
    
        read_rationals(A, N);
        print_rationals(A, N);
    
        return 0;
    }