fork download
  1. #include <iostream>
  2. #include <map>
  3. #include <vector>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8.  
  9. const int bucket_size = 10;
  10. int one;
  11. int two;
  12.  
  13. int userInput = 0;
  14. vector<int> myVector;
  15.  
  16. cout << "Enter student's grades (-1 to stop list): ";
  17.  
  18. //stores grades in vector while not -1
  19.  
  20. while(userInput != -1){
  21. cin >> userInput;
  22. myVector.push_back(userInput);
  23. }
  24.  
  25. //create map from integer to integer for histogram algorithm
  26.  
  27. map<int, int> histogram;
  28.  
  29. histogram.first = one;
  30. histogram.second = two;
  31.  
  32.  
  33.  
  34.  
  35. return 0;
  36. }
Compilation error #stdin compilation error #stdout 0s 15240KB
stdin
20 30 70 -1
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:29:12: error: ‘class std::map<int, int>’ has no member named ‘first’
  histogram.first = one;
            ^~~~~
prog.cpp:30:12: error: ‘class std::map<int, int>’ has no member named ‘second’; did you mean ‘end’?
  histogram.second = two;
            ^~~~~~
stdout
Standard output is empty