满意答案
yuxk8ihb8
2013.11.01
采纳率:52% 等级:13
已帮助:16318人
有个C++ 的
改一下就好:
#include
#include
using namespace std;
void test_read() {
int s=0, i=0;
bool ischar = false;
int a[11];
ifstream fs("d:\\test.txt");
char c;
while (fs.get(c)) {
if ((c<90&&c>65)||(c<122&&c>97))
{
ischar = true;
// nothing to do
} else {
if (c<=57&&c>=48) {
s*=10;
int i=c-48;
s+=i*10;
ischar = false;
} else {
if(!ischar)
{
a[i++]=s/10;
}
s=0;
}
}
}
if(!fs.get(c))
{
a[i++]=s/10;
}
int j=i-1;
for (i=0; i
cout<
}
}
int main() {
test_read();
return 0;
}
00分享举报