Other cadets credited their corps training with helping to minimize the carnage at the school. But Mr. Cruz’s ties to the corps — The Associated Press reported that he had honed his shooting skills on its marksmanship team — raised troubling questions.
The Pentagon spends $370 million a year on Junior R.O.T.C. programs at about 3,400 high schools across the country, hoping to foster the next generation of military leaders. Some communities welcome Junior R.O.T.C., but in others, it meets resistance from parents and advocacy groups who say it promotes militarism among impressionable youths.
Junior R.O.T.C. has been criticized for focusing on poorer schools with larger minority populations, and for using scarce resources to steer students toward the military, rather than giving them skills for other careers. The program does not require students to commit to enlisting in the military, and its leaders say it instills discipline and integrity that can help students in any career.
Mr. Wang’s funeral on Tuesday was attended by hundreds of people. He lay in an open coffin in the small chapel at Kraeer Funeral Home, dressed in a Junior R.O.T.C. uniform like the one he wore the day he was killed, with the Medal for Heroism pinned to the chest. A line of mourners, many of them in uniform, stretched out of the chapel.
Gov. Rick Scott ordered the Florida National Guard to honor the three cadets. Veterans from all over the country began a campaign to mail military patches to Mr. Wang’s family. And those who knew him spoke in tribute.
“He was always looking to do things for others before himself,” said a classmate, Logan De Lima, 13.
Ms. Petty, 14, whose funeral was Monday, saw the Junior R.O.T.C. program as a way to give back to the community, according to a statement from her family, who carried in her coffin covered by an American flag. “She loved to serve,” the statement said.
Cadets were also among the wounded in the attack at the school. Samantha Fuentes, an 18-year-old senior, was shot in both legs and was left with a piece of shrapnel lodged behind her right eye.
Ms. Fuentes said in an interview that she had known Mr. Cruz from the corps. She and other students were sheltering in a classroom, she said, when gunfire burst through the narrow pane of glass next to the room’s locked door. Two in the classroom were killed. Mr. Cruz then looked in to see what he had wrought, she said, and she saw his face.
When the attack began, she said, the class had been discussing hate groups and the history of the Holocaust.