Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with adding Symbols inside the C++ and java language 2011
#1
Want to add certain symbols inside my program in C++ how it will work see the code
using namespace std;

int main()

{


string line;
string total;
ifstream myfile ("tr.txt");
if (myfile.is_open())
{
while ( myfile.good() )
{
getline (myfile,line);
total = total + line;
}
myfile.close();
}




typedef boost::tokenizer< boost::char_separator<char> > tokenizer_type ;

const char* const dropped_delimiters = "',/!@#$%^&*()-_=+|]}[{:;'?/>.<,\\" ; // nothing

const char* const kept_delimiters = " \t" ; // space, tab

boost::char_separator<char> separator( dropped_delimiters, kept_delimiters ) ;

tokenizer_type toker( total, separator ) ;

int cnt = 0 ;

for( tokenizer_type::iterator beg = toker.begin() ; beg != toker.end(); ++beg )

std::cout << "token " << ++cnt << ": '" << *beg << "'\n";

}
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  array project code c++ 2011 Vuhelper 0 1,276 12-10-2011, 06:32 PM
Last Post: Vuhelper
  factorial in C++ code 2011 Vuhelper 0 952 12-10-2011, 06:31 PM
Last Post: Vuhelper
  stack during function call in C++ 2011 Vuhelper 0 2,028 11-05-2011, 05:05 PM
Last Post: Vuhelper
  What is the Thing Queue? in c++ 2011 Vuhelper 0 1,785 11-05-2011, 05:02 PM
Last Post: Vuhelper
  ASCII to char conversion code in C++ 2011 Vuhelper 0 1,724 11-05-2011, 05:01 PM
Last Post: Vuhelper
  How to write a summation in a sequence? C++ 2011-12 Vuhelper 2 1,357 09-19-2011, 04:53 AM
Last Post: Xpert
  GetPixel problem in c++ 2011-12 Vuhelper 0 2,507 09-18-2011, 07:12 PM
Last Post: Vuhelper
  C++ with loop code 2011-12 Vuhelper 0 979 09-18-2011, 07:09 PM
Last Post: Vuhelper
  how can i read the last letter of a input file? 2011 Vuhelper 0 1,834 09-12-2011, 10:24 PM
Last Post: Vuhelper
  Different syntax? in c++ 2011-12 Vuhelper 0 1,762 09-12-2011, 10:22 PM
Last Post: Vuhelper

Forum Jump:


Users browsing this thread: 1 Guest(s)