ALL > Computer and Education > courses > university courses > undergraduate courses > An Overview of Computer Science > zstu-(2019-2020-1) class >
Homework_4.2_2019529628035_Mwika Mangaza Annie Version 0
👤 Author: by amwika2019gmailcom 2019-11-09 05:41:07
#include <iostream>

#include <algorithm>

#include <iterator>

#include <utility>

 

int main()

{

std::pair<char, int> a[] =

{

{ 'a', 2 },

{ 'b', 1 },

{ 'b', 2 },

{ 'a', 1 }

};

for ( const auto &p : a )

{

std::cout << p.first << '\t' << p.second << std::endl;

}

std::cout << std::endl;

std::sort( std::begin( a ), std::end( a ) );

for ( const auto &p : a )

{

std::cout << p.first << '\t' << p.second << std::endl;

}

return 0;

}

Please login to reply. Login

Reversion History

Loading...
No reversions found.