F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

View Compilation Error

0_0_33752644_22588.cpp: In function 'int main()':
0_0_33752644_22588.cpp:9:18: error: conflicting declaration 'std::map<std::basic_string<char>, int> shop'
  map<string,int> shop;
                  ^
0_0_33752644_22588.cpp:8:9: note: previous declaration as 'std::string shop'
  string shop;
         ^
0_0_33752644_22588.cpp:23:9: error: no match for 'operator[]' (operand types are 'std::string {aka std::basic_string<char>}' and 'std::string {aka std::basic_string<char>}')
     shop[shop]+=price; 
         ^
0_0_33752644_22588.cpp:23:9: note: candidates are:
In file included from GCC4.9.2/x86_64-w64-mingw32/include/c++/string:52:0,
                 from GCC4.9.2/x86_64-w64-mingw32/include/c++/bits/locale_classes.h:40,
                 from GCC4.9.2/x86_64-w64-mingw32/include/c++/bits/ios_base.h:41,
                 from GCC4.9.2/x86_64-w64-mingw32/include/c++/ios:42,
                 from GCC4.9.2/x86_64-w64-mingw32/include/c++/ostream:38,
                 from GCC4.9.2/x86_64-w64-mingw32/include/c++/iostream:39,
                 from 0_0_33752644_22588.cpp:1:
GCC4.9.2/x86_64-w64-mingw32/include/c++/bits/basic_string.h:836:7: note: std::basic_string<_CharT, _Traits, _Alloc>::const_reference std::basic_string<_CharT, _Traits, _Alloc>::operator[](std::basic_string<_CharT, _Traits, _Alloc>::size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::basic_string<_CharT, _Traits, _Alloc>::const_reference = const char&; std::basic_string<_CharT, _Traits, _Alloc>::size_type = long long unsigned int]
       operator[] (size_type __pos) const _GLIBCXX_NOEXCEPT
       ^
GCC4.9.2/x86_64-w64-mingw32/include/c++/bits/basic_string.h:836:7: note:   no known conversion for argument 1 from 'std::string {aka std::basic_string<char>}' to 'std::basic_string<char>::size_type {aka long long unsigned int}'
GCC4.9.2/x86_64-w64-mingw32/include/c++/bits/basic_string.h:853:7: note: std::basic_string<_CharT, _Traits, _Alloc>::reference std::basic_string<_CharT, _Traits, _Alloc>::operator[](std::basic_string<_CharT, _Traits, _Alloc>::size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::basic_string<_CharT, _Traits, _Alloc>::reference = char&; std::basic_string<_CharT, _Traits, _Alloc>::size_type = long long unsigned int]
       operator[](size_type __pos)
       ^
GCC4.9.2/x86_64-w64-mingw32/include/c++/bits/basic_string.h:853:7: note:   no known conversion for argument 1 from 'std::string {aka std::basic_string<char>}' to 'std::basic_string<char>::size_type {aka long long unsigned int}'
0_0_33752644_22588.cpp:27:10: error: no match for 'operator=' (operand types are 'std::map<std::basic_string<char>, int>::iterator {aka std::_Rb_tree_iterator<std::pair<const std::basic_string<char>, int> >}' and 'std::basic_string<char>::iterator {aka __gnu_cxx::__normal_iterator<char*, std::basic_string<char> >}')
    for(it=shop.begin();it!=shop.end();it++)
          ^
0_0_33752644_22588.cpp:27:10: note: candidates are:
In file included from GCC4.9.2/x86_64-w64-mingw32/include/c++/map:60:0,
                 from 0_0_33752644_22588.cpp:2:
GCC4.9.2/x86_64-w64-mingw32/include/c++/bits/stl_tree.h:172:12: note: std::_Rb_tree_iterator<std::pair<const std::basic_string<char>, int> >& std::_Rb_tree_iterator<std::pair<const std::basic_string<char>, int> >::operator=(const std::_Rb_tree_iterator<std::pair<const std::basic_string<char>, int> >&)
     struct _Rb_tree_iterator
            ^
GCC4.9.2/x86_64-w64-mingw32/include/c++/bits/stl_tree.h:172:12: note:   no known conversion for argument 1 from 'std::basic_string<char>::iterator {aka __gnu_cxx::__normal_iterator<char*, std::basic_string<char> >}' to 'const std::_Rb_tree_iterator<std::pair<const std::basic_string<char>, int> >&'
GCC4.9.2/x86_64-w64-mingw32/include/c++/bits/stl_tree.h:172:12: note: std::_Rb_tree_iterator<std::pair<const std::basic_string<char>, int> >& std::_Rb_tree_iterator<std::pair<const std::basic_string<char>, int> >::operator=(std::_Rb_tree_iterator<std::pair<const std::basic_string<char>, int> >&&)
GCC4.9.2/x86_64-w64-mingw32/include/c++/bits/stl_tree.h:172:12: note:   no known conversion for argument 1 from 'std::basic_string<char>::iterator {aka __gnu_cxx::__normal_iterator<char*, std::basic_string<char> >}' to 'std::_Rb_tree_iterator<std::pair<const std::basic_string<char>, int> >&&'
0_0_33752644_22588.cpp:27:26: error: no match for 'operator!=' (operand types are 'std::map<std::basic_string<char>, int>::iterator {aka std::_Rb_tree_iterator<std::pair<const std::basic_string<char>, int> >}' and 'std::basic_string<char>::iterator {aka __gnu_cxx::__normal_iterator<char*, std::basic_string<char> >}')
    for(it=shop.begin();it!=shop.end();it++)
                          ^
0_0_33752644_22588.cpp:27:26: note: candidates are:
In file included from GCC4.9.2/x86_64-w64-mingw32/include/c++/map:60:0,
                 from 0_0_33752644_22588.cpp:2:
GCC4.9.2/x86_64-w64-mingw32/include/c++/bits/stl_tree.h:235:7: note: bool std::_Rb_tree_iterator<_Tp>::operator!=(const _Self&) const [with _Tp = std::pair<const std::basic_string<char>, int>; std::_Rb_tree_iterator<_Tp>::_Self = std::_Rb_tree_iterator<std::pair<const std::basic_string<char>, int> >]
       operator!=(const _Self& __x) const _GLIBCXX_NOEXCEPT
       ^
GCC4.9.2/x86_64-w64-mingw32/include/c++/bits/stl_tree.h:235:7: note:   no known conversion for argument 1 from 'std::basic_string<char>::iterator {aka __gnu_cxx::__normal_iterator<char*, std::basic_string<char> >}' to 'const _Self& {aka const std::_Rb_tree_iterator<std::pair<const std::basic_string<char>, int> >&}'
In file included from GCC4.9.2/x86_64-w64-mingw32/include/c++/iosfwd:40:0,
                 from GCC4.9.2/x86_64-w64-mingw32/include/c++/ios:38,
                 from GCC4.9.2/x86_64-w64-mingw32/include/c++/ostream:38,
                 from GCC4.9.2/x86_64-w64-mingw32/include/c++/iostream:39,
                 from 0_0_33752644_22588.cpp:1:
GCC4.9.2/x86_64-w64-mingw32/include/c++/bits/postypes.h:221:5: note: template<class _StateT> bool std::operator!=(const std::fpos<_StateT>&, const std::fpos<_StateT>&)
     operator!=(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
     ^
GCC4.9.2/x86_64-w64-mingw32/include/c++/bits/postypes.h:221:5: note:   template argument deduction/substitution failed:
0_0_33752644_22588.cpp:27:37: note:   'std::map<std::basic_string<char>, int>::iterator {aka std::_Rb_tree_iterator<std::pair<const std::basic_string<char>, int> >}' is not derived from 'const std::fpos<_StateT>'
    for(it=shop.begin();it!=shop.end();it++)
                                     ^
In file included from GCC4.9.2/x86_64-w64-mingw32/include/c++/bits/stl_algobase.h:64:0,
                 from GCC4.9.2/x86_64-w64-mingw32/include/c++/bits/char_traits.h:39,
                 from GCC4.9.2/x86_64-w64-mingw32/include/c++/ios:40,
                 from GCC4.9.2/x86_64-w64-mingw32/include/c++/ostream:38,
                 from GCC4.9.2/x86_64-w64-mingw32/include/c++/iostream:39,
                 from 0_0_33752644_22588.cpp:1:
GCC4.9.2/x86_64-w64-mingw32/include/c++/bits/stl_pair.h:227:5: note: template<class _T1, class _T2> constexpr bool std::operator!=(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&)
     operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
     ^
GCC4.9.2/x86_64-w64-mingw32/include/c++/bits/stl_pair.h:227:5: note:   template argument deduction/substitution failed:
0_0_33752644_22588.cpp:27:37: note:   'std::map<std::basic_string<char>, int>::iterator {aka std::_Rb_tree_iterator<std::pair<const std::basic_string<char>, int> >}' is not derived from 'const std::pair<_T1, _T2>'
    for(it=shop.begin();it!=shop.end();it++)
                                     ^
In file included from GCC4.9.2/x86_64-w64-mingw32/include/c++/bits/stl_algobase.h:67:0,
                 from GCC4.9.2/x86_64-w64-mingw32/include/c++/bits/char_traits.h:39,
                 from GCC4.9.2/x86_64-w64-mingw32/include/c++/ios:40,
                 from GCC4.9.2/x86_64-w64-mingw32/include/c++/ostream:38,
                 from GCC4.9.2/x86_64-w64-mingw32/include/c++/iostream:39,
                 from 0_0_33752644_22588.cpp:1:
GCC4.9.2/x86_64-w64-mingw32/include/c++/bits/stl_iterator.h:304:5: note: template<class _Iterator> bool std::operator!=(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&)
     operator!=(const reverse_iterator<_Iterator>& __x,
     ^
GCC4.9.2/x86_64-w64-mingw32/include/c++/bits/stl_iterator.h:304:5: note:   template argument deduction/substitution failed:
0_0_33752644_22588.cpp:27:37: note:   'std::map<std::basic_string<char>, int>::iterator {aka std::_Rb_tree_iterator<std::pair<const std::basic_string<char>, int> >}' is not derived from 'const std::reverse_iterator<_Iterator>'
    for(it=shop.begin();it!=shop.end();it++)
                                     ^
In file included from GCC4.9.2/x86_64-w64-mingw32/include/c++/bits/stl_algobase.h:67:0,
                 from GCC4.9.2/x86_64-w64-mingw32/include/c++/bits/char_traits.h:39,
                 from GCC4.9.2/x86_64-w64-mingw32/include/c++/ios:40,
                 from GCC4.9.2/x86_64-w64-mingw32/include/c++/ostream:38,
                 from GCC4.9.2/x86_64-w64-mingw32/in


Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-24 22:00:48, Gzip enabled