double sum=0,average=0;
array
double temp;
while(cin>>temp&&i<10&&!isdigit(temp)) {
ad[i]=temp; sum+=ad[i]; ++i; }
if(i!=0) average=sum/i;
for(int j=0;javerage) ++total;
cout<<\这些数字的平均值为\ cout<<\并且共有\个数字大于平均值。\\n\
return 0; }
//ex.6.3
#include
int main() {
using namespace std;
cout<<\ <<\
<<\书上的这个f个人认为是打印错误
cout<<\
char ch; cin>>ch;
while(ch!='c'&&ch!='p'&&ch!='t'&&ch!='g')
{
cout<<\ cin>>ch; }
switch(ch) {
case 'c':
cout<<\ break; case 'p':
cout<<\ break; case 't':
cout<<\ break; case 'g':
cout<<\ }
return 0; }
//ex.6.4
#include
struct bop{
char fullname[strsize]; char title[strsize]; char bopname[strsize]; int preference; };
int main() {
using namespace std;
cout<<\ <<\ <<\ <<\ char ch; bop member[5]={
{\
{\
{\ {\ {\
};
cout<<\ while(cin>>ch&&ch!='q') {
switch(ch) {
case 'a':
for(int i=0;i<5;i++)
cout< for(int i=0;i<5;i++) cout< for(int i=0;i<5;i++) cout< for(int i=0;i<5;i++) { if(member[i].preference==0) cout< break; } cout<<\ } cout<<\ return 0; } //ex.6.5 #include { using namespace std; double income,revenue; cout<<\请输入你的收入:\ while(cin>>income&&income>=0) { if(income<=5000) revenue=0.0; else if(income<=15000) revenue=0.1*(income-5000); else if(income<=35000) revenue=0.1*(15000-5000)+0.15*(income-15000); else revenue=0.1*(15000-5000)+0.15*(35000-15000)+0.2*(income-35000); cout<<\你的所得税为\ cout<<\请输入你的收入:\ } return 0; } //ex.6.6 #include int main() { int num,temp=0; cout<<\请输入捐款的人数:\ cin>>num; cin.get();