Figures I would search for the wrong thing...
Anyway, I hate to be a bother but is there any speacific reason why "no" always returns as 0?
Code:
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <string>
#include <map>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
string search = "#include";
std::string word;
vector<string> vs;
//int no= 0;
std::fstream file("main.cpp",std::ios::in);
while(getline(file,word,static_cast<char>(0x3)))
{
vs.push_back(word);
}
int no = count(vs.begin(),vs.end(),search);
cout<<word;
cout<<no;
std::cin.get();
return EXIT_SUCCESS;
}
As far as I can tell I'm using the count() functions correctly, and there is obviously more than 0 #includes in the string...
Bleh ><