Submission #6941712


Source Code Expand

#include <bits/stdc++.h>
using namespace std;

int main() {
  string s;
  cin >> s;
  string str1(1234), str2(1), str3(12345678);
  str2 = " ";
  for (int i = 0; i < 4; i++) {
    str1.at(i) = s.at(i);
  }
  for (int i = 0; i < 8; i++) {
    str3.at(i) = s.at(i + 4);
  }
  cout << str1 << str2 << str3 << endl;
}

Submission Info

Submission Time
Task A - CODEFESTIVAL 2016
User aonagi
Language C++14 (GCC 5.4.1)
Score 0
Code Size 330 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:7:19: error: no matching function for call to ‘std::basic_string<char>::basic_string(int)’
   string str1(1234), str2(1), str3(12345678);
                   ^
In file included from /usr/include/c++/5/string:52:0,
                 from /usr/include/c++/5/bits/locale_classes.h:40,
                 from /usr/include/c++/5/bits/ios_base.h:41,
                 from /usr/include/c++/5/ios:42,
                 from /usr/include/c++/5/istream:38,
                 from /usr/include/c++/5/sstream:38,
                 from /usr/include/c++/5/complex:45,
                 from /usr/include/c++/5/ccomplex:38,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
                 from ./Main.cpp:1:
/usr/include/c++/5/bits/basic_string.h:3012:9: note: candidate: template<class _InputIterator> std::basic_string<_CharT, _Traits, _Alloc>::basic_string(_InputIterator, _InputIterator, const _Alloc&)
         basic_string(_InputIterator __beg, _InputIterator _...