#include
Void main (void)
{
Typedef struct people
{
Int bianhao;
Char xingming [20]={0};
Float jibengongzi;
Float jiangjin.
Float biaoxian;
} PEOPLE;
Int n, I;
Float shuijin [20]={0}, shifagongzi [20]={0};
PEOPLE mub [20].
PEOPLE * p=mub;
Printf (" please input you want to input the number of n: ");
Scanf_s (" % d ", & amp; N);
for (i=0; i
Printf (" please enter the first % d a basic wage bonus insurance code name ", I + 1);
Scanf_s (" % d ", & amp; Mub [I] bianhao);
Mub scanf_s (" % s ", [I] xingming);
Scanf_s (" % f ", & amp; Mub [I] jibengongzi);
Scanf_s (" % f ", & amp; Mub [I]. Jiangjin);
Scanf_s (" % f ", & amp; Mub [I] biaoxian);
}
For (I=0; I & lt; n; I++)/* calculate taxes */
{
Shuijin [I]=((p [I] jibengongzi) + (p [I]. Jiangjin)) * 0.05;
Scanf_s (" % f ", & amp; Shuijin [I]);
}
For (I=0; I & lt; n; I++)/* computing real salary */
{
Shifagongzi [I]=(p [I] jibengongzi) + (p [I]. Jiangjin) - (p [I]. Biaoxian) - shuijin [I];
Scanf_s (" % f ", & amp; Shifagongzi [I]);
}
For (I=0; I & lt; n; I++)
{
Printf (" name: number: % d % c taxes: %, 2 f real salary: %, 2 f \ n ", p [I] bianhao, p [I] xingming, shuijin [I], shifagongzi [I]);
}
system("pause");
}
CodePudding user response:
Char xingming [20]={0}Instead of char xingming [20];
CodePudding user response:
1, the first add# pragma warning (4996) disable:
Behind the scanf, alternative scanf_s
2, scanf_s (" % s ", mub [I] xingming, 20).