h4ex1: Structure, basic programming

h4ex1: Structure, basic programming

Description

A complex number is composed of a real part and of an imaginary part. Create a structure to represent complex numbers. Write two functions to calculate the product and the sum of two complex numbers. A third function should ask the user to input two complex numbers together with an operation, and then display the result.

Format

Files

You should submit a tar file containing a c source file ex1.c

Input

two complex numbers whose real and imaginary parts are integers and an operator on one line

Output

one complex number on one line

if the imaginary part of the result is 0, use "+0i"

Note

no space is allowed in a complex number; expected format is \(sa\pm bi\), where \(s\) is - or nothing and \(a\) and \(b\) are two numbers.

Sample 1

Input

1+2i 3-4i +

Output

4-2i

Limitation

1s, 32MiB for each test case.

Information

Difficulty
7
Category
(None)
Tags
(None)
# Submissions
210
Accepted
37
Accepted Ratio
18%
Uploaded By