Usage of to と in this children's book


I've been trying to improve my Japanese by translating a children's book. I
only studied Japanese for a short while over 10 years ago so my grammar
knowledge is very flawed and I've never read books before, only manga, so I
mostly only know the basic grammar used in everyday conversations.

> 「どうしてないているの？」 **と** るるちゃんがきく **と** 、  
>  「おさんぽをしていたら、おうちにかえれなくなったの。」  
>  **と** ちいさなおばけはこたえました。

I'm confused to the use of と here. All three of them. I can understand what it
says without knowing, but I really want a better understanding the usage of と
here.




The と's after the quotations are the quotative case particle
([引用]{いんよう}の[格助詞]{かくじょし}).

> 「どうしてないているの？」 **と** るるちゃんがき(いた)  
>  "Why are you crying?" asked Ruru-chan.
>
> 「おさんぽをしていたら、おうちにかえれなくなったの。」 **と** ちいさなおばけはこたえました。  
>  "I lost my way home while taking a walk," replied the little ghost.

The と in 聞くと is a conjunctive particle ([接続助詞]{せつぞくじょし}) for "If" or "When".
(This と attaches to the terminal form ([終止形]{しゅうしけい}) of a conjugatable word
([活用語]{かつようご}).)

> るるちゃんが聞く **と** 、～～  
>  **When** Ruru-chan asked, ~~

