又有问题拉!
vood 2003-10-18 07:34:56 写了这个程序,为什么结果老是0呢?
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
void main(){
string str;
int i=0;
ifstream in("e:\\buildtree.cpp");
while(getline(in,str))
{
if (str=="char") i++;
}
cout<<i<<endl;
}