C++ map 中的reverse_iterator
生活随笔
收集整理的這篇文章主要介紹了
C++ map 中的reverse_iterator
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
做了一個閩南師范大學(xué)OJ上的題,不想寫排序,用了一下reverse_iterator,反向遍歷容器
7006:學(xué)生成績排序
Problem Description
使用結(jié)構(gòu)數(shù)組存儲學(xué)生信息,信息包括了姓名name和成績score,按學(xué)生成績從高到低排序,并輸出。?Input
輸入文件首先包含一個整數(shù)n(n<10),表示有n個學(xué)生,然后是n行學(xué)生記錄,一行代表一個學(xué)生,每個學(xué)生的name的長度小于15,且score為int型。
?Output
輸出按成績排序后學(xué)生的相關(guān)記錄,每個信息之間用兩個空格分隔,一個學(xué)生信息輸出一行,如下。?Sample Input
6 GongJing 80 LiuNa 90 ZhouLi 86 ChenHai 95 SunYan 76 WangHong 98?Sample Output
name:WangHong score:98 name:ChenHai score:95 name:LiuNa score:90 name:ZhouLi score:86 name:GongJing score:80 name:SunYan score:76
總結(jié)
以上是生活随笔為你收集整理的C++ map 中的reverse_iterator的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 在实际管理中学习管理
- 下一篇: C++ ifstream 从文件中 字符