?? p209 例 7.2.cpp
字號:
#include<iostream>
using namespace std;
int main()
{ struct person
{ char *name;
int count;
}vote[3]={"Li",0,"Zhang",0,"Fun",0};
char * vote_name=new char[8];
int i,j;
for(i=0;i<10;i++)
{ cout<<"please input the vote_name "<<i+1<<" ";
cin>>vote_name;
for(j=0;j<3;j++)
if(strcmp(vote[j].name,vote_name)==0) vote[j].count++;
}
for(j=0;j<3;j++) { cout<<"the number of voter "<<vote[j].name<<" is "<<vote[j].count<<endl; }
system("pause");
return 0;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -