对候选人得票的统计程序。设有3个候选人,每次输入一个得票的候选人的名字,要求最后输出各人得票结果。
#include"stdio.h"
#define N 3
#include"string.h"
void InputName(struct student stu[], int n);
void Vote(struct student stu[], int n);
void Output(struct student stu[], int n);
struct student{
char name[10];
int count;
};
int main()
{
struct student stu[N];
InputName(stu, N);
Vote(stu, N);
Output(stu, N);
return 0;
}
void InputName(struct student stu[], int n)
{

本文介绍了一个统计三个候选人得票的程序。用户每次输入一个候选人的名字,程序会记录投票结果,最终输出每个候选人的得票数。程序可以采用C++或C语言实现,支持在定义结构体变量时进行初始化。
最低0.47元/天 解锁文章
1万+

被折叠的 条评论
为什么被折叠?



