64,685
社区成员
发帖
与我相关
我的任务
分享
#include<iostream>
#include<fstream>
using namespace std;
int tongji(int &n)
{
ifstream file("d:\\001.txt",ios::in);
float a;
char b;
int num1=0,num2=0;
while(!file.eof())
{
file>>a;
num1++;
file>>b;
num2++;
}
n=num1;
return num2 ;
}
void main()
{
int nn=0,cc=0;
cc=tongji(nn);
cout<<"数字个数:"<<nn<<endl;
cout<<"字符个数:"<<cc<<endl;
}