foo.cc: In function 'int main()':
foo.cc:8:13: error: conflicting declaration 'int a'
8 | int a,b;cin>>a>>b;
| ^
foo.cc:7:16: note: previous declaration as 'std::string a'
7 | string a;
| ^
foo.cc:9:24: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}
9 | cout<<a.substr(a,b);
| ^
| |
| std::string {aka std::__cxx11::basic_string<char>}
In file included from /nix/gcc-13.2.0/include/c++/13.2.0/string:54,
from /nix/gcc-13.2.0/include/c++/13.2.0/bitset:52,
from stdc++.h:52:
/nix/gcc-13.2.0/include/c++/13.2.0/bits/basic_string.h:3151:24: note: initializing argument 1 of 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::substr(size_type, size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
3151 | substr(size_type __pos = 0, size_type __n = npos) const
| ~~~~~~~~~~^~~~~~~~~