编写一个程序,统计一个人朋友圈点赞的记录
时间: 2024-02-22 08:56:19 浏览: 34
好的,以下是一个简单的C++程序,用于统计一个人朋友圈点赞的记录:
```c++
#include <iostream>
#include <vector>
using namespace std;
int main() {
vector<string> likes; // 用vector来存储点赞记录
string name; // 朋友圈主人的名字
int num; // 点赞的总次数
cout << "请输入朋友圈主人的名字:";
cin >> name;
cout << "请输入点赞的总次数:";
cin >> num;
// 循环读入每一条点赞记录
for (int i = 1; i <= num; i++) {
string like;
cout << "请输入第" << i << "条点赞记录:";
cin >> like;
likes.push_back(like); // 将记录加入到vector中
}
// 输出点赞记录
cout << endl << name << "的点赞记录如下:" << endl;
for (int i = 0; i < likes.size(); i++) {
cout << likes[i] << endl;
}
return 0;
}
```
以上程序使用了vector来存储点赞记录,可以根据需要随时添加和删除记录。在输入点赞记录时,可以输入任意字符串,比如点赞者的名字、时间等等。程序最终会输出所有的点赞记录。