For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-C
std::vector<System::SharedPtr<Paragraph>> ParagraphsByStyleName(System::SharedPtr<Document> doc, System::String const &styleName)
{
    // Create an array to collect paragraphs of the specified style.
    std::vector<System::SharedPtr<Paragraph>> paragraphsWithStyle;
    // Get all paragraphs from the document.
    System::SharedPtr<NodeCollection> paragraphs = doc->GetChildNodes(NodeType::Paragraph, true);
    // Look through all paragraphs to find those with the specified style.
    for (System::SharedPtr<Paragraph> paragraph : System::IterateOver<System::SharedPtr<Paragraph>>(paragraphs))
    {
        if (paragraph->get_ParagraphFormat()->get_Style()->get_Name() == styleName)
        {
            paragraphsWithStyle.push_back(paragraph);
        }
    }
    return paragraphsWithStyle;
}