fork download
  1. #include <vector>
  2. #include <iostream>
  3. #include <fstream>
  4. #include <string>
  5.  
  6. using namespace std;
  7.  
  8.  
  9. int main()
  10. {
  11. vector<hash> hashes;
  12. system("pause");
  13. }
  14.  
  15. int iterateHash()
  16. {
  17. string word = "lalalalalala";
  18. for (vector<hash>::iterator it = hashes.begin(); it != hashes.end(); ++it)
  19. {
  20. if (word == *it.word) it.number++; // this line has two erros obviously
  21.  
  22. }
  23. }
  24.  
  25.  
  26.  
  27. struct hash()
  28. {
  29. string word;
  30. int number;
  31. }
  32.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:11:13: error: type/value mismatch at argument 1 in template parameter list for ‘template<class _Tp, class _Alloc> class std::vector’
  vector<hash> hashes;
             ^
prog.cpp:11:13: error:   expected a type, got ‘hash’
prog.cpp:11:13: error: template argument 2 is invalid
prog.cpp:11:21: error: invalid type in declaration before ‘;’ token
  vector<hash> hashes;
                     ^
prog.cpp:11:15: warning: unused variable ‘hashes’ [-Wunused-variable]
  vector<hash> hashes;
               ^
prog.cpp: In function ‘int iterateHash()’:
prog.cpp:18:18: error: type/value mismatch at argument 1 in template parameter list for ‘template<class _Tp, class _Alloc> class std::vector’
  for (vector<hash>::iterator it = hashes.begin(); it != hashes.end(); ++it)
                  ^
prog.cpp:18:18: error:   expected a type, got ‘hash’
prog.cpp:18:18: error: template argument 2 is invalid
prog.cpp:18:30: error: invalid type in declaration before ‘it’
  for (vector<hash>::iterator it = hashes.begin(); it != hashes.end(); ++it)
                              ^
prog.cpp:18:30: error: expected ‘;’ before ‘it’
prog.cpp:18:30: error: ‘it’ was not declared in this scope
prog.cpp:18:35: error: ‘hashes’ was not declared in this scope
  for (vector<hash>::iterator it = hashes.begin(); it != hashes.end(); ++it)
                                   ^
prog.cpp:18:69: error: expected ‘)’ before ‘;’ token
  for (vector<hash>::iterator it = hashes.begin(); it != hashes.end(); ++it)
                                                                     ^
prog.cpp:18:21: warning: unused variable ‘iterator’ [-Wunused-variable]
  for (vector<hash>::iterator it = hashes.begin(); it != hashes.end(); ++it)
                     ^
prog.cpp:18:73: error: ‘it’ was not declared in this scope
  for (vector<hash>::iterator it = hashes.begin(); it != hashes.end(); ++it)
                                                                         ^
prog.cpp:18:75: error: expected ‘;’ before ‘)’ token
  for (vector<hash>::iterator it = hashes.begin(); it != hashes.end(); ++it)
                                                                           ^
prog.cpp:23:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
prog.cpp: At global scope:
prog.cpp:27:8: error: template argument required for ‘struct hash’
 struct hash()
        ^
prog.cpp:27:13: error: expected unqualified-id before ‘)’ token
 struct hash()
             ^
stdout
Standard output is empty