Home > Back-end >  Why the results after addition and subtraction of 0?
Why the results after addition and subtraction of 0?

Time:09-29

#include
Struct member
{
Char name [10].
Float jiben;
Float fudong;
Float zhichu;
Float salary;
};
Int main ()
{
Int N, I;
Struct member m1 [100];
The scanf (" % d ", & amp; N);
For (I=0; i {
The scanf (" % s % f % f % f ", & amp; M1 [I]. Name, & amp; M1 [I]. Jiben, & amp; M1 [I]. Fudong, & amp; M1 [I] zhichu);
M1 [I]. Salary=(m1 [I] jiben + m1 [I] fudong) - m1 [I] zhichu;
}
For (I=0; i {
Printf (" % s % 2 f ", & amp; M1 [I]. Name, & amp; M1 [I]. Salary);
Putchar (" \ n ");
}
}

CodePudding user response:

 # include 
Struct member
{
Char name [10].
Float jiben;
Float fudong;
Float zhichu;
Float salary;
};
Int main ()
{
Int N, I;
Struct member m1 [100];
The scanf (" % d ", & amp; N);
If (N & gt; 100)
N=100;
For (I=0; i {
//the scanf (" % s % f % f % f ", & amp; M1 [I]. Name, & amp; M1 [I]. Jiben, & amp; M1 [I]. Fudong, & amp; M1 [I] zhichu);
The scanf (" % s % f % f % f ", m1 [I]. Name, & amp; M1 [I]. Jiben, & amp; M1 [I]. Fudong, & amp; M1 [I] zhichu);
M1 [I]. Salary=(m1 [I] jiben + m1 [I] fudong) - m1 [I] zhichu;
}
For (I=0; i {
//printf (" % s % 2 f ", & amp; M1 [I]. Name, & amp; M1 [I]. Salary);
Printf (" % s % 2 f ", m1 [I]. Name, m1 [I]. Salary).
Putchar (" \ n ");
}
}

For your reference ~

CodePudding user response:

Printf without & amp;
  • Related