Submission #6941747


Source Code Expand

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

int main() {
  string s;
  cin >> s;
  string str1"1234", str2, 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 327 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:7:14: error: expected initializer before string constant
   string str1"1234", str2, str3"12345678";
              ^
./Main.cpp:8:3: error: ‘str2’ was not declared in this scope
   str2 = " ";
   ^
./Main.cpp:10:5: error: ‘str1’ was not declared in this scope
     str1.at(i) = s.at(i);
     ^
./Main.cpp:13:5: error: ‘str3’ was not declared in this scope
     str3.at(i) = s.at(i + 4);
     ^
./Main.cpp:15:11: error: ‘str1’ was not declared in this scope
   cout << str1 << str2 << str3 << endl;
           ^
./Main.cpp:15:27: error: ‘str3’ was not declared in this scope
   cout << str1 << str2 << str3 << endl;
                           ^