请问

请教
include "stdafx.h"
#include<string>
#include<iostream>
#include<sstream>
#include<vector>
#include<fstream>
using namespace std;


int _tmain(int argc, _TCHAR* argv[])
{
ifstream infile;
vector<string> svec;
string line;
infile.open("g.txt");

while(!infile.eof()){
getline(infile,line);
svec.push_back(line);
}

int p=0;
for(vector<string>::iterator it=svec.begin();it!=svec.end();it++)
{
if((*it)=="/n")
{
p++;
if(*(++it)!="/n")
cout<<p<<"/n"<<endl;
p=0;
}

}

return 0;
}

g.txt
如下int int /n
/n
char int /n
/n
/n
/n 3/n
while char /n
/n
/n 2/n 以下类同
case if /n
char /n
if /n
if /n
break /n
/n
case if /n
/n
/n
/n
char /n
if /n
char /n
/n
/n
/n
break /n
本意想几个连续的“/n”合并在一起

------解决方案--------------------
说错了,看走眼了
if((*it)=="/n")
{
p++;
while(*(++it)!="/n")
cout<<p<<"/n"<<endl;
p=0;
}
尝试下