fork(2) download
  1. #include <iostream> // std::cout
  2. #include <fstream> // std::ifstream
  3. #include <vector>
  4. #include <string>
  5. #include <cstdlib>
  6. #include <sstream>
  7. #include <cctype>
  8. #include <iomanip>
  9. using namespace std; ////////////////////////////////////////////////////////////////////////////////////
  10.  
  11.  
  12.  
  13. bool is_number(const std::string& s){ /// DO NOT FORGET WHAT"S BELOW THIS~!^#$*&$%*^%%^&$%^$#^$^%$^*^&(%^&^%^*^*^&(&*(&%&%
  14. return !s.empty() && s.find_first_not_of("0123456789") == string::npos; /// I'm supposed to check this line , SO DO NOT FORGET!!!!!!!!@#!@#!@#!!@#!@#!@#!@#!!!
  15. } /// /// /// //////////////////////////////////////////////////////////////////////
  16.  
  17.  
  18. /// normal = no more than 6 digits
  19. /// scientific = no more than 7 digits
  20.  
  21. struct data{
  22.  
  23. data operator>>(string s){
  24. cout<<endl<<s;
  25. }
  26.  
  27. operator bool(){
  28. cout<<endl<<"NICE TO MEET YOU";
  29. return true;
  30. }
  31. };
  32.  
  33.  
  34.  
  35. int main(){
  36. string a = " hey 1234 man of 5678";
  37. stringstream strstr(a);
  38. string test;
  39. vector<int>numvec;
  40. int num;
  41. while(strstr>>num || !strstr.eof()){
  42. if(strstr.fail()){
  43. strstr.clear();
  44. string kpz;
  45. strstr>>kpz;
  46. continue;
  47. }
  48. numvec.push_back(num);
  49. }
  50. for(int i = 0;i < numvec.size();++i){
  51. cout<<numvec[i]<<'\t';
  52. }
  53. return 0;
  54. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
1234	5678