百科题库网 分享最新题库资源与答题解析


2006年11月8日,北京市有800多万选民在全市12000多个投票站投票,选举出新一届区县人大代表4403人、乡镇人大代表9983人。胡锦涛等党和国家领导人也参加了北京区县人大代表的选举。这说明,我国的根本政治制度是


A.社会主义制度   
B.人民代表大会制度
C.中国共产党领导的多党合作制度   
D.民族区域自治制度

所属分类: 政治 (免费栏目) 浏览量: 62 次


给你一个参考的,
不过这个程序是4个候选人,并且用的人名,而不是20个候选人编号:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define CANDIDATES 4
const char candi[4][10] ={"zhao","qian","sun","li"};//参选人名
const char jobs[4][29] ={"general manager","technical director",
"Financial Controller","marketing manager"};//职位名称

struct votepaper
{
char paper[5];
struct votepaper *next;
};
typedef struct votepaper vote;

void papercount(vote *head, int count[][5]);
vote *creatlist(int num);
int votecount(char *p, int i);

int main(void)
{
vote *head;
int num;
int count[CANDIDATES][5] = {0};//4*4统计表

printf("Enter the number of voter,num:\n");
scanf("%d", &num);//选民人数
head = creatlist(num);//建立链表
papercount(head, count);//统计选票

return 0;
}

vote *creatlist(int num)
{
vote *head, *pf, *pb;
int i;

head = (vote *) malloc(sizeof(vote));
head->next = NULL;

if(head == NULL)
{
printf("Failed to creat list;\n");
exit(1);
}
else
{ pf = head;
/*选民输入格式为对应人名下输入相应职位名称的
头一个字母的大写,对于不投给他票的下面画X, */
printf("Pls enter the characters:\n");
printf("such as:GTF, TFGM or XXG……\n");
printf("G: general manager T: technical director\n");
printf("F: Financial Controller M: marketing manager\n");
printf("X: means no choice of the man\n");

for(i=0; i< num; i++)
{
pb = (vote *) malloc(sizeof(vote));
printf("\n------------------------------------------\n");
printf("candidates:\nzhao\tqian\tsun\tli\n");
printf("------------------------------------------\n");
scanf("%s",pb->paper);
pf->next = pb;
pb->next = NULL;
pf = pb;
}

}
return head;
}

void papercount(vote *head, int count[][5])
{
int i,j,max;
int result;
head = head->next;//头结点为空,指向其下一个结点。
while(head != NULL)//每个结点(选民投的票)统计
{
for(i=0; i < CANDIDATES; i++ )
{
result = votecount(head->paper, i);//查表转换成对应的列数
count[i][result]++;//行为人名,列为职位名
}
head = head->next;
}
printf("\t");
printf("%c\t%c\t%c\t%c\n",'G','T','F','M');
for(i=0; i < 4; i++)
{
printf("%5s:\t", candi[i]);
for(j=0; j < CANDIDATES; j++)
printf("%d\t",count[i][j]);
printf("\n");
}
for(i=0; i < 4; i++) //输出统计结果,每列比较大小,每列中最大的为该职位的当选者。
{
max = 0;
for(j=0; j < CANDIDATES; j++)
{
if(count[i][j] >count[i][max])
max = j;
}
printf("Congratulations! %s is %s !\n", jobs[i], candi[max]);
}
}

int votecount(char *p, int i)
{
int count;
switch(p[i])
{
case 'G':count = 0;break;
case 'T':count = 1;break;
case 'F':count = 2;break;
case 'M':count = 3;break;
default: count = 4;
}
return count;

}

以上为百科题库网整理的关于"2006年11月8日,北京市有800多万选民在全市12000多个投票站投票,选举出新一届区县人大代表4403人、乡镇人大代表9983人。胡锦涛等党和国家领导人也参加了北京区县人大代表的选举。这说明,我国的根本政治制度是"试题答案及解析,如想学习更多政治类竞赛题,欢迎访问www.baiketk.com查看搜索更多相关信息。

转载请注明:百科题库网https://www.baiketk.com/q_m609362b521961.html


相关题目推荐