如何用我c++写这个程序

img


第一个程序中的排序如何实现,第二个程序中的关键词如何查找,如何统计,选做实验又要怎么做出来。

你是需要代码吗

#include <iostream>
#include <string> 
#include <algorithm>

using namespace std;

int main() 
{
    string words[100];
    int n;
    cout << "请输入单词个数:";
    cin >> n;
    cout << "请输入" << n << "个单词:" << endl;

    for (int i = 0; i < n; i++) {
        cin >> words[i];
    }

    sort(words, words + n);

    for (int i = 0; i < n; i++) {
        cout << words[i] << " "; 
    }
    cout << endl;
}

找我吧