TimeFractal 26 Newbie Poster
#include <iostream>
#include <string>


int main(void)
{
    using namespace std;

    string in_str;
    cout << "Enter the a sentence " << endl;
    getline(cin,in_str);

    int const screen_len = 10;
    int in_len = in_str.size();

    int pad_left  = (screen_len - in_len)/2;
    int pad_right = screen_len - pad_left - in_len;

    string out_str = string( " ", pad_left ) + in_str + string( " ", pad_right );
    cout << out_str;

    return 0;
}
TimeFractal 26 Newbie Poster
#include <algorithm>

// for each student
for(int i = 0; i < students.size(); i++)
   {
   // display exam codes in ascending order
   std::sort( students.at(i).examcode.begin(), students.at(i).examcode.end() );

   for (int j = 0; j < students.at(i).examcode.size (); j++)
      cout << students.at (i).examcode.at(j) << "\n";
   }

see reference for sort() here: http://www.cppreference.com/cppalgorithm/sort.html