Ex. 4.1 Structure, basic programming

Ex. 4.1 Structure, basic programming

You cannot submit for this problem because the homework's deadline is due.

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

GNUMake

If you choose GNUMake, then you should compress assignment.h, ex1.c, ex2.c, ex3.c, main.c, Makefile directly into a zip and submit this zip. (A sample Makefile for hw4 is uploaded on Canvas).

If you just finished ex1 and you immediately want to test whether your ex1 is working correctly. You need to modify your main.c, assignment.h, Makefile (delete ex2.c ex3.c) and then compress main.c,assignment.h,Makefile,ex1.c into a zip and submit this zip.

The sample Makefile on Canvas has -o main, do not change this main!

CMake

If you choose CMake, then you should compress assignment.h, ex1.c, ex2.c, ex3.c, main.c, CMakeLists.txt directly into a zip and submit this zip. (A sample CMakeLists.txt for hw4 is uploaded on Canvas).

If you just finished ex1 and you immediately want to test whether your ex1 is working correctly. You need to modify your main.c, assignment.h, CMakeLists.txt (delete ex2.c ex3.c) and then compress main.c,assignment.h,CMakeLists.txt,ex1.c into a zip and submit this zip.

The sample CMakeLists.txt on Canvas has add_executable(main ..., do not change this main! Also, do not change cmake_minimum_required(VERSION 2.7)

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

Homework 4 (Group)

Not Claimed
Status
Finished
Problems
3
Open Since
2019-10-25 00:00
DDL
2019-10-29 23:59
Extension
24.0 hour(s)