----------------解决方案--------------------------------------------------------
他简单了吧,使用文本读取,就可以了嘛
----------------解决方案--------------------------------------------------------
/*除了空格没有删掉以外,其他完成了,刚学的方法没多久,各位高手多指教*/
#include <fstream> #include <iostream> #include <string>
using namespace std;
int main() { ifstream infile("a.txt"); ofstream outfile("new.txt"); string word; char c; int count=0; while(infile>>word) { for(int i=0;i<word.length();i++) if(word[i]=='A'||word[i]=='E'||word[i]=='I'||word[i]=='O'||word[i]=='U') count++; outfile<<word; infile.get(c); outfile.put(c); } cout<<"the number of the vowel is "<<count<<"."<<endl; return 0; }
[此贴子已经被作者于2004-10-18 15:18:01编辑过]
----------------解决方案--------------------------------------------------------
空格好象是'23',有的编译器用'40',自己试到行为止吧。
----------------解决方案--------------------------------------------------------
三少爷,你二哥和大哥怎么没上论坛啊?呵呵
----------------解决方案--------------------------------------------------------