diff --git a/apps/boilerplate-generator/src/GenerateFullBoilerplate/generateFullCpp.ts b/apps/boilerplate-generator/src/GenerateFullBoilerplate/generateFullCpp.ts index 798dc7a..cbf60f9 100644 --- a/apps/boilerplate-generator/src/GenerateFullBoilerplate/generateFullCpp.ts +++ b/apps/boilerplate-generator/src/GenerateFullBoilerplate/generateFullCpp.ts @@ -13,15 +13,15 @@ export default function generateFullCpp({ const inputReads = inputFields .map((field, index) => { if (field.type.startsWith("list<")) { - return `int size_${field.name};\n std::istringstream(lines[${index}]) >> size_${field.name};\n ${makeType.ToCpp(field.type)} ${field.name}(size_${field.name});\n if(size_${field.name} != 0) {\n \tstd::istringstream iss(lines[${index + 1}]);\n \tfor (int i=0; i < size_${field.name}; i++) iss >> ${field.name}[i];\n }`; + return `int size_${field.name};\n istringstream(lines[${index}]) >> size_${field.name};\n ${makeType.ToCpp(field.type)} ${field.name}(size_${field.name});\n if(size_${field.name} != 0) {\n \tistringstream iss(lines[${index + 1}]);\n \tfor (int i=0; i < size_${field.name}; i++) iss >> ${field.name}[i];\n }`; } else { - return `${makeType.ToCpp(field.type)} ${field.name};\n std::istringstream(lines[${index}]) >> ${field.name};`; + return `${makeType.ToCpp(field.type)} ${field.name};\n istringstream(lines[${index}]) >> ${field.name};`; } }) .join("\n "); const outputType = outputFields[0].type; const functionCall = `${outputType} result = ${functionName}(${inputFields.map((field) => field.name).join(", ")});`; - const outputWrite = `std::cout << result << std::endl;`; + const outputWrite = `cout << result << endl;`; return ` #ifndef _GLIBCXX_NO_ASSERT #include @@ -116,10 +116,10 @@ export default function generateFullCpp({ ##USER_CODE_HERE## int main() { - std::ifstream file("${process.env.PV_DIR_PATH}/${problemName.replace(" ", "-")}/tests/inputs/##INPUT_FILE_INDEX##.txt"); - std::vector lines; - std::string line; - while (std::getline(file, line)) lines.push_back(line); + ifstream file("${process.env.PV_DIR_PATH}/${problemName.replace(" ", "-")}/tests/inputs/##INPUT_FILE_INDEX##.txt"); + vector lines; + string line; + while (getline(file, line)) lines.push_back(line); file.close(); ${inputReads} diff --git a/apps/problems/Reverse-String/tests/inputs/3.txt b/apps/problems/Reverse-String/tests/inputs/3.txt index 702f3a0..84e3a85 100644 --- a/apps/problems/Reverse-String/tests/inputs/3.txt +++ b/apps/problems/Reverse-String/tests/inputs/3.txt @@ -1 +1 @@ -A man a plan a canal Panama \ No newline at end of file +letgoo \ No newline at end of file diff --git a/apps/problems/Reverse-String/tests/inputs/4.txt b/apps/problems/Reverse-String/tests/inputs/4.txt index e69de29..1c6dbf1 100644 --- a/apps/problems/Reverse-String/tests/inputs/4.txt +++ b/apps/problems/Reverse-String/tests/inputs/4.txt @@ -0,0 +1 @@ +yup \ No newline at end of file