Home > Back-end >  Freshman learning data structure when plural abstract data types when I don't know why the erro
Freshman learning data structure when plural abstract data types when I don't know why the erro

Time:03-10

In station b with Qingdao university teacher study times wrong don't know why
The compiler is vc + + 6.0
Here is the source code

# include
Typedef struct
{
Float realpart;/* real */
Float imagpart; Imaginary part/* */
} Complex;/* to define the plural abstract type */
Void the assign (Complex * A, float real, float imag);/* * assignment/
Void the add (Complex * c, Complex, A Complex B);/* */
A + BVoid minus (Complex * c, Complex, A Complex B); A - B/* */
The main ()
{
Complex z1, z2, z;
Float realpart imagpart;
To assign (z1, 8.0, 6.0);
To assign (z2, 4.0, 3.0);
Add (z, z1, z2);
}

Void the assign (Complex * A, float real, float imag)
{
A - & gt; Realpart=real; *//* real assignment
A - & gt; Imagpart=imag;/* */imaginary part assignment
}
Void the add (Complex * c, Complex, A Complex B)
{
C - & gt; Realpart=A.r ealpart + B.r ealpart;/* real component addition */
C - & gt; B.i imagpart=Anderson magpart + magpart; Imaginary part addition/* */
}
Void minus (Complex * c, Complex, A Complex B)
{
C - & gt; Realpart=A.r ealpart - B.r ealpart;/* real component is presupposed */
C - & gt; Imagpart=Anderson magpart - B.i magpart;/* imaginary part is presupposed */
}

New folder D: \ \ 676756856\689787896 c (14) : error C2115: 'function: incompatible types
D: \ \ 676756856\689787896. A new folder (14) c: warning C4024: 'assign' : the company types for formal and actual parameter 1
New folder D: \ \ 676756856\689787896 c (15) : error C2115: 'function: incompatible types
New folder D: \ \ 676756856\689787896 c (15) : warning C4024: 'assign' : the company types for formal and actual parameter 1
New folder D: \ \ 676756856\689787896 c (16) : error C2115: 'function: incompatible types
New folder D: \ \ 676756856\689787896 c (16) : warning C4024: 'add' : the company types for formal and actual parameter 1

For help with the click of a spray, great god,,

CodePudding user response:

Where is the spray? Use the mouse to point?
The function In the main, you called other function with a "value" as the 1 st argument,
But that function needs an "address" here.
  • Related