0 like 0 dislike
1.3k views

Perform addition operation on complex data using class and object. The program should ask for real and imaginary part of two complex numbers, and display the real and imaginary parts of their sum.

Example input:

5 2
2 3

Example output:

7+5i

 

[Exercise] Coding (C) - asked in C++
ID: 24392 - Available when: Unlimited - Due to: Unlimited
| 1.3k views
0 0
Called for Help
0 0
Called for Help

42 Answers

0 like 0 dislike
Hidden content!
#include <iostream>

#include <cstdlib>

#include<cmath>

using namespace std;

class add{
* ** * * ** ***** * *****
* *** *** * * * * * ** ** * * ** * a;
* * ** * * * * ** * *** * * *** *** * ** b;
** * * ** * **** *** *** * * ***** * * * c;
**** *** ** * * ** * * * * ** ** * * * *** ** d;

};

int main(){

    add number;
** * **** *** **** **** *** ** * * * **** ****** **** *** **** * * * ****** ****
** * *** ** *** * * * * * *
* *** *** * ** *** ** * ***** ****** * ** ** *** ** * * **** * **** * *** **** * * * * ** * * ** * *** * * ** **
** ** ** *** * ** **** * ***
*** **** *** *** ** **** * ******* ***** * * * * * * ** * *** * * ***
*** * ** ** * **** * 0;

}
answered by (-384 points)
0 like 0 dislike
Hidden content!
#include <iostream>

#include <cstdlib>

#include<cmath>

using namespace std;

class add{
* ** ** *** *** **** ** ****
* *** * ******* * ***** * *** * *** a;
** *** ***** * ** **** * * * * * ** *** ********* b;
**** * * * * * **** *** ** **** ** * c;
* * *** ** ** * * * * * ******** * *** *** * d;

};

int main(){
* **** * * **** * * number;
** * ** ** * * * **** * *** * ***** * *** *** ** ***** * ** * **
* ** ** * * * * ** ** * * * ** * * * ** ** ** ** * * **** ** * *** *** ** ** ** * *
* *** *** * *** * 0;

}
answered by (-384 points)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.70.127.123
©2016-2024

Related questions

0 like 0 dislike
30 answers
[Exercise] Coding (C) - asked May 18, 2017 in C++
ID: 24769 - Available when: Unlimited - Due to: Unlimited
| 828 views
0 like 0 dislike
20 answers
[Exercise] Coding (C) - asked Apr 27, 2017 in C++
ID: 24393 - Available when: Unlimited - Due to: Unlimited
| 734 views
0 like 0 dislike
17 answers
[Exercise] Coding (C) - asked Jun 1, 2017 in C++
ID: 24855 - Available when: Unlimited - Due to: Unlimited
| 618 views
0 like 0 dislike
27 answers
[Exercise] Coding (C) - asked Apr 27, 2017 in C++
ID: 24389 - Available when: Unlimited - Due to: Unlimited
| 892 views
12,783 questions
183,443 answers
172,219 comments
4,824 users