#include "stdafx.h"#include <iostream>using namespace std;struct person{ char name[20]; int count;}leader[3]={"A",0,"B",0,"C",0};void sr(int a);void jp(char a);void sr(int a){ int i; for(i=0;i<3;i++) { cin>>a; jp(a); }}void jp(char a){ int j; for(j=0;j<=3;j++) {if(leader[j].name==a) leader[j].count++; }}int main(){ char name; int i,a; cout<<"输入0投给A"<<endl<<"输入1投给B"<<endl<<"输入2投给C"<<endl; sr(a); for(i=0;i<3;i++) { cout<<leader[i].name<<"的票数为"<<leader[i].count<<endl; } system("pause"); return 0;}
1 回答
- 1 回答
- 1 关注
- 1657 浏览
添加回答
举报
0/150
提交
取消