patron *ps=new patron[num];
for(int i=0;i cout<<\请输入第\位捐款人的名字:\ getline(cin,ps[i].name); cout<<\请输入第\位捐款人捐款的数目:\ cin>>ps[i].money; cin.get(); } cout<<\ for(int i=0;i cout< if(temp==0) cout<<\ cout<<\ for(int i=0;i cout< if(temp==0) cout<<\ delete [] ps; return 0; } //ex.6.7 #include int main() { using namespace std; int vowel=0,consonant=0,other=0; char word[15]; cout<<\ while(cin>>word) { if(isalpha(word[0])) { if(word[0]=='q'&&strlen(word)==1) break; else if(word[0]=='a'||word[0]=='i'|| word[0]=='u'||word[0]=='e'||word[0]=='o') ++vowel; else ++consonant; } else ++other; } cout< cout< //ex.6.8 #include int main() { using namespace std; char ch; int sum=0; ifstream inFile; inFile.open(\ if(!inFile.is_open()) { cout<<\ cout<<\ exit(EXIT_FAILURE); } inFile>>ch; while(inFile.good()) { ++sum; inFile>>ch; } if(inFile.eof()) cout<<\ else if(inFile.fail()) cout<<\ else cout<<\ cout<<\总共有\个字符在这个文件中。\ return 0; } //ex.6.9 #include struct member { char name[20]; double donation; }; int main() { using namespace std; int num,count1=0,count2=0; ifstream fin; char file[20]; cout<<\ cin.getline(file,20); fin.open(file); if(!fin.is_open()) { cout<<\ cout<<\ exit(EXIT_FAILURE); } fin>>num; fin.get(); member *pd=new member[num]; for(int i=0;i fin.getline(pd[i].name,20); fin>>pd[i].donation; fin.get(); } cout<<\ for(int i=0;i cout< if(count1==0) cout<<\ cout<<\ for(int i=0;i