首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >python日期判断星座_python实现根据月份和日期得到星座的方法

python日期判断星座_python实现根据月份和日期得到星座的方法

作者头像
用户7886150
修改2021-01-04 10:07:15
修改2021-01-04 10:07:15
3.1K0
举报
文章被收录于专栏:bit哲学院bit哲学院

参考链接: C++程序按字典顺序(字典顺序)对元素进行排序

本题为《C++程序设计原理与实践》Chapter3 习题7 参考链接: C++中输入字符串的几种方法 C++ 字符串与字符数组 详解 

#include <algorithm>

#include <iostream>

#include <string>

#include <vector>

using namespace std;

void PrintF(string& StringPrint) {

    cout << StringPrint << endl;

}

int main() {

    vector<string> studentName;

    vector<string>::iterator studentIterator;

    string str1, str2, str3;

    getline(cin, str1);

    getline(cin, str2);

    getline(cin, str3);

    studentName.push_back(str1);

    studentName.push_back(str2);

    studentName.push_back(str3);

    //输出未排序的名字

    cout << "排序前的名字:" << endl;

    for_each(studentName.begin(), studentName.end(), PrintF);

    sort(studentName.begin(), studentName.end());  //排序函数

    cout << "排序后的名字:" << endl;

    for_each(studentName.begin(), studentName.end(), PrintF);

    system("pause");

    return 0;

}

本文系转载,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档