When baby is in the uterus
nutrition and oxygen
go to the fetus through placenta from the mother.lungs of fetus is in collapsed condition.
After delivery when baby bornes and cord is cut off for baby oxygen required so for oxygen lungs should be working and at this time cry of the baby is essential so to inflate the lungs cry is a must.
After crying lungs open and fresh oxygen baby gets.At this time full crying of baby is must to open lungs fully,each and every part of the lung fully open and lungs start working.
So crying of baby is for the lungs and not for the heart.
I think this will satisfy your query.
ok and bye.