fork download
  1. int main()
  2. {
  3. std::string lux, ir, returnS;
  4. std::ostringstream ss1, ss2;
  5. int iLux, iIR;
  6.  
  7. returnS = getLight();
  8.  
  9. for ( std::string::iterator it = returnS.begin(); it != (returnS.find("/")-1); it++)
  10. {
  11. ss1 << returnS[it];
  12. }
  13.  
  14. iLux = std::stoi(ss1.str());
  15.  
  16. std::size_t found = returnS.find("/");
  17.  
  18. for(int i = found+1; i < returnS.end(); i++)
  19. {
  20. ss2 << returnS[i];
  21. }
  22.  
  23. iIR = std::stoi(ss2.str());
  24.  
  25. std::cout << "Current lux: " << iLux << std::endl << "Current IR: " << iIR << std::end;
  26. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:3:9: error: 'string' is not a member of 'std'
         std::string lux, ir, returnS;
         ^
prog.cpp:4:9: error: 'ostringstream' is not a member of 'std'
         std::ostringstream ss1, ss2;
         ^
prog.cpp:7:9: error: 'returnS' was not declared in this scope
         returnS = getLight();
         ^
prog.cpp:7:28: error: 'getLight' was not declared in this scope
         returnS = getLight();
                            ^
prog.cpp:9:20: error: 'std::string' has not been declared
         for ( std::string::iterator it = returnS.begin(); it != (returnS.find("/")-1); it++)
                    ^
prog.cpp:9:59: error: 'it' was not declared in this scope
         for ( std::string::iterator it = returnS.begin(); it != (returnS.find("/")-1); it++)
                                                           ^
prog.cpp:11:10: error: 'ss1' was not declared in this scope
          ss1 << returnS[it];
          ^
prog.cpp:14:16: error: 'stoi' is not a member of 'std'
         iLux = std::stoi(ss1.str());
                ^
prog.cpp:14:26: error: 'ss1' was not declared in this scope
         iLux = std::stoi(ss1.str());
                          ^
prog.cpp:16:9: error: 'size_t' is not a member of 'std'
         std::size_t found = returnS.find("/");
         ^
prog.cpp:18:21: error: 'found' was not declared in this scope
         for(int i = found+1; i < returnS.end(); i++)
                     ^
prog.cpp:20:10: error: 'ss2' was not declared in this scope
          ss2 << returnS[i];
          ^
prog.cpp:23:15: error: 'stoi' is not a member of 'std'
         iIR = std::stoi(ss2.str());
               ^
prog.cpp:23:25: error: 'ss2' was not declared in this scope
         iIR = std::stoi(ss2.str());
                         ^
prog.cpp:25:9: error: 'cout' is not a member of 'std'
         std::cout << "Current lux: " << iLux << std::endl << "Current IR: " << iIR << std::end;
         ^
prog.cpp:25:49: error: 'endl' is not a member of 'std'
         std::cout << "Current lux: " << iLux << std::endl << "Current IR: " << iIR << std::end;
                                                 ^
prog.cpp:25:87: error: 'end' is not a member of 'std'
         std::cout << "Current lux: " << iLux << std::endl << "Current IR: " << iIR << std::end;
                                                                                       ^
stdout
Standard output is empty