1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Aleksandr [31]
3 years ago
8

Define a data type for representing complex numbers. (A complex number consists of 'real' and 'imaginary' parts. The real and im

aginary parts can represent the x and y coordinates of a point on a plane.) How can a complex data type be created? (pick correct choice in Illustration 2 )
Computers and Technology
1 answer:
qwelly [4]3 years ago
5 0

Answer:

A complex data type can be created by the use of class or structures.

#include <iostream>

using namespace std;

class complex{//creating a class complex to store a complex value.

public://defining all the values public.

int real;

int img;

complex(int real,int img)//parameterized constructor.

{

    this->real=real;

    this->img=img;

}

};

int main() {

   complex n1(1,2);//n1 is a complex number with real part 1 and imaginary part 2.

   cout<<n1.real<<" i"<<n1.img<<endl;

return 0;

}

Output

1 i2

Explanation:

I have created a class complex to store complex number with two integer parts real and imaginary.You can also declare them float if you wan to store decimal values and after that i have created a parameterized constructor with real and imaginary values.So we can assign the values at the time of declaration of the object of class complex.

You might be interested in
Which file types have .exe and .png as their extensions?
cricket20 [7]
EXE files are executable files.
PNG files are picture files like JPEG etc.
7 0
4 years ago
Consider an array of integers consisting of the numbers: 8 12 19 32 45 55 67 72 89 90 92. Suppose the binary search algorithm is
ankoles [38]

Answer:

Answered below

Explanation:

Index of the first element compared to the key is 5. The element itself is 55.

This index is evaluated by the addition of the index of the first element which is 0(zero) and the the index of the last element which is 10.

( Index of the last element is determined by subtracting the one from the total number of elements)

After the addition, the result is divided by 2 to get the first index from which the binary search begins.

firstIndex = 0

lastIndex = array.length - 1

midpoint = (firstIndex + lastIndex) / 2

6 0
3 years ago
While traditionally employers used computers to track ordering and inventory, computers are used now to
AlexFokin [52]

Answer:

The correct answer should be A. automate merchandise ordering and inventorying.

5 0
4 years ago
What is the power dissipated by a resistor with a current of 0.02 A and a resistance of 1,000 ?
Anna11 [10]

0.4 watt has a resistance of 1000


8 0
3 years ago
OSHA standards appear in the ___________ and are then broken down into ____________.
Alisiya [41]
OSHA standards appear in the Code of Federal Regulations (CFR) <span>and was then broken down into two parts. It contains standards to ensure a </span>
4 0
3 years ago
Other questions:
  • Given a int variable named calls Received and another int variable named operators On Call write the necessary code to read valu
    14·1 answer
  • Access Help defaults to searching for information on the _________.<br><br> Not multiple choice
    10·1 answer
  • What is the exposition of the movie inside out
    13·2 answers
  • True or false.local and cloud backup differs in where the backup is saved
    15·2 answers
  • Program 1: I’m buyin’ a Ferrari! If you’ve ever travelled to another country, you know that working with different currencies ta
    6·1 answer
  • Network servers and web servers are examples of what type of server?
    9·2 answers
  • The router is physically located in a server room that requires an ID card to gain access. You've backed up the router configura
    8·1 answer
  • Why am I constantly getting bombarded with brainly plus ads and how to fix this without paying for it?
    13·2 answers
  • What is the alogarithm for solving the perimeter of a triangle
    11·1 answer
  • Lol WAKE UP!!! and get ready to answer my questions.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!