Welcome![Sign In][Sign Up]
Location:
Downloads SourceCode Windows Develop Other
Title: choose Download
 Description: #include <iostream> using namespace std struct Person//声明结构体类型Person; { char name[20] int count } int main() { Person leader[3]={"aaa",0,"bbb",0,"ccc",0} //定义Person类型的数组,内容为当前候选人的姓名及得票数; char leader_name[20] //leader_name为投票人所选的人姓名; int i,j for(i=0 i<10 i++) { cin>>leader_name //先后输入十张票上所选的人的姓名; for(j=0 j<3 j++) { if(strcmp(leader_name,leader[j].name)==0) leader[j].count++ //所选人与候选人的姓名相同,则该候选人的票数加1; } } cout<<endl double round for(i=0 i<3 i++) { round=leader[i].count/10 cout<<leader[i].name<<":"<<"得票数:"<<leader[i].count<<"得票率:"<<round<<endl } return 0 }
 Downloaders recently: [More information of uploader 962106292]
 To Search:
File list (Check if you may need any files):
Debug\BuildLog.htm
.....\choose.exe.embed.manifest
.....\choose.exe.embed.manifest.res
.....\choose.exe.intermediate.manifest
.....\choose.pch
.....\choose.pdb
.....\leader.obj
.....\mt.dep
.....\vc60.idb
.....\vc60.pdb
.....\vc90.idb
.....\vc90.pdb
choose.dsp
choose.dsw
choose.ncb
choose.sln
choose.vcproj
choose.vcproj.WIN-74UE0280MC2.Administrator.user
leader.cpp
Debug
    

CodeBus www.codebus.net