结构体数组问题
以下是得票统计代码,运行后提示如下:e:\struct\struct\11.2.c(15): warning C4013: “strcmp”未定义;假设外部返回 int我用的是visual studio 2013,strcmp()函数应该怎样用,我看网上是用strcmp_s,头文件是string.h吗?请帮忙解决一下,谢谢
#include<stdio.h>
#include<string.h>
void main()
{
struct person
{
char name[20];
int count;
}leader[3] = { { "xiaoli", 0 }, { "xiaofang", 0 }, { "xiaoming", 0 } };
char lead_name[20];
int i, j;
for (i = 0; i < 10; i++)
scanf_s("%s", lead_name);
for (j = 0; j < 3; j++)
if (strcmp(lead_name, leader[j]) == 0)leader[j].count++;
printf("\n");
for (i = 0; i < 3; i++)
printf("%5s;%d\n", leader[i].name, leader[i].count);
}