Coding Games and Programming Challenges to Code Better
Send your feedback or ask for help here!
Created by @Lisa-Has-Ideas,validated by @FredericLocquet,@Timinator and @Laars.
If you have any issues, feel free to ping them.
Coding Games and Programming Challenges to Code Better
Send your feedback or ask for help here!
Created by @Lisa-Has-Ideas,validated by @FredericLocquet,@Timinator and @Laars.
If you have any issues, feel free to ping them.
hello, i like the simplicy of the puzzle, it ACTUALLY an easy and not COMPLEX puzzle, but i’m having trouble with the rule ( more detail would be better), i getting the same output for the test 1, but it validating, and for a left arrow, where it should start: here is my code (not optimize at all) but just for output purpos (c++):
`#include
#include
#include
#include
#include
int main()
{
std::string input;
getline(std::cin, input);
std::istringstream iss(input);
std::vector<std::string> c1;
std::string c2,c3;
while (iss >> c2) {
c1.push_back(c2);
}
if(c1[0] == “right”){
for (int l=0; l < std::stoi(c1[2]);l++){
for(int i=0; i < std::stoi(c1[1]);i++){
for (int j=0; j < std::stoi(c1[3]);j++){
c3+=“>”;
}
if(i!=std::stoi(c1[1])-1){
for (int k=0; k < std::stoi(c1[4]);k++){
c3+=" ";
}
}
}
c3+="\n";
if(l< std::stoi(c1[2])/2){
for (int n=0;n<l+1;n++){
for (int m=0; m < std::stoi(c1[5]);m++){
c3+=" ";
}
}
}else{
for (int o=2; o < std::stoi(c1[2])-l;o++){
for (int p=0; p < std::stoi(c1[5]);p++){
c3+=" ";
}
}
}
}
}else{ // left
for (int l=0; l < std::stoi(c1[2]);l++){
if (l==0){
for(int i=1;i< std::stoi(c1[2]);i++){
for(int j=0; j <std::stoi(c1[5]);j++){
c3+=" ";
}
}
}
for(int i=0; i < std::stoi(c1[1]);i++){
for (int j=0; j < std::stoi(c1[3]);j++){
c3+="<";
}
if(i!=std::stoi(c1[1])){
for (int k=0; k < std::stoi(c1[4]);k++){
c3+=" ";
}
}
}
c3+="\n";
if(l< std::stoi(c1[2])/2){
for (int o=2; o < std::stoi(c1[2])-l;o++){
for (int p=0; p < std::stoi(c1[5]);p++){
c3+=" ";
}
}
} else{ for (int n=0;n<l+1;n++){
for (int m=0; m < std::stoi(c1[5]);m++){
c3+=" ";
}
}
}
}
}
std:: cout<<c3<< std::endl;
return 0;
}
`
invalid literal for int() with base 10
This kept being a problem when trying to convert the string numbers into ints.
Print to the error stream what parameter your code passed to the int() function, and debug from there.