fork download
  1. unsigned int SLOC_2( std::fstream *inFile)
  2. {
  3. unsigned loc = 0;
  4. bool singleLineComment = false;
  5. bool multiLineComment = false;
  6. unsigned int stringLen = 0;
  7. char c;
  8.  
  9. do{
  10. inFile->get(c);
  11.  
  12. if(c == '/' && ( inFile->peek() == '/' || inFile->peek() == '*') && !multiLineComment && !singleLineComment){
  13. if(inFile->peek() == '/'){
  14. singleLineComment = true;
  15. }
  16. else if(inFile->peek() == '*'){
  17. multiLineComment = true;
  18. }
  19. }
  20. else{
  21. if(multiLineComment){
  22. if(c == '*' && inFile->peek() == '/'){
  23. inFile->get(c);
  24. multiLineComment = false;
  25. }
  26. }
  27. else if (singleLineComment){
  28. if(c == '\n')
  29. singleLineComment = false;
  30. }
  31. else{
  32. if(c !=' ' && c != '\n' && c != ';')
  33. ++stringLen;
  34. else if(c == ';' && stringLen){
  35. ++loc;
  36. stringLen = 0;
  37. }
  38. }
  39.  
  40. }
  41.  
  42.  
  43. }while(!inFile->eof());
  44.  
  45. return loc;
  46. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:22: error: 'fstream' is not a member of 'std'
 unsigned int SLOC_2( std::fstream *inFile)
                      ^
prog.cpp:1:36: error: 'inFile' was not declared in this scope
 unsigned int SLOC_2( std::fstream *inFile)
                                    ^
prog.cpp:2:1: error: expected ',' or ';' before '{' token
 {
 ^
stdout
Standard output is empty