How do i make my character attack (melee)?

i only know about how to get the input of player and making it to the function; example

PlayerInputComponent->BindAction("attack", IE_Pressed, this, &AAccursed6Character::attack);

then it will go to this function

void AAccursed6Character::attack()
{
 // input code here that will make the character attack
}

i have an attacking animation, my only problem is how do i call it using c++, pls help,beginner here.

not an answer to the question as i dont mess with c++ too much, but these might be very helpful for you (the first two are pretty bad mic quality but after that its all good) UE4 Melee Weapon tutorial Part1 - YouTube