Mountain flower grove c++ help

code

auto colors = ["pink", "red", "blue", "purple", "yellow", "white", "random"];
index = len(colors);

function drawCircle(x, y, size) {
    angle = 0;
    while (angle <= Math.PI * 2) {
        newX = x + (size * Math.cos(angle));
        newY = y + (size * Math.sin(angle));
        hero.moveXY(newX, newY);
        hero.toggleFlowers(True);
        angle += 0.2;
    }
}

for(int i = 0; i < friends.size(); i++) {
    
}

ERORR(auto colors = ["pink", "red", "blue", "purple", "yellow", "white", "random"];)

@itik As a Python User my help may be limited, but you do have an empty for loop at the end of your code!!

for(int i = 0; i < friends.size(); i++) {
    
}

The error is the loop with an undefined array, friends is undefined, and c++ is trying to do undefined.size() and it goes insane

1 Like

Yeah @moonwatcher348 is right!!

you need to define friends using

friends = hero.findFriends();

P.S. I think that is how it is written in C++ but you just define friends

No, c++ requires type or auto, so
auto friends = hero.findFriends();

2 Likes

Well I did say I was a python user

should i use python?

It is an easy, and understandable programming language, that aligns with English. And it is a very popular programming language!!

I would recommend it, but C++ is used for coding games and it is one of the founding programming languages, so it is your choice!!

Python is annoying to code complex things though :) and can’t be used on the web without a compiler, if you want to make webpages, use JavaScript, for apps, c++, for games, c++ or python

1 Like

Still Erorr Same Erorr

auto colors = ["pink", "red", "blue", "purple", "yellow", "white", "random"];
index = len(colors);

function drawCircle(x, y, size) {
    angle = 0;
    while (angle <= Math.PI * 2) {
        newX = x + (size * Math.cos(angle));
        newY = y + (size * Math.sin(angle));
        hero.moveXY(newX, newY);
        hero.toggleFlowers(True);
        angle += 0.2;
    }
}
auto friends = hero.findFriends();
for(int i = 0; i < friends.size(); i++) {
    
}

Ok, @itik

It is asking you for a semi-colon at the end (I see you already did it, but you need to run the code after fixing the problem, that is why the run button is glowing!!)

Just run the code!!

Cheers,
Goutham KR

1 Like

i can’t run it it stand stiill when irun

nvm i use movexy and run around and i sucsseces

Nice!! (20 CHARS WHYYYYYYYYY)