This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ctype.h> | |
void trim(char * const a) | |
{ | |
char *p = a, *q = a; | |
while (isspace(*q)) ++q; | |
while (*q) *p++ = *q++; | |
*p = '\0'; | |
while (p > a && isspace(*--p)) *p = '\0'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Whatever you do, when asked to enumerate permutations of length n, | |
// don't demonstrate that you can quickly produce this solution... | |
#include <algorithm> | |
#include <cerrno> | |
#include <cstdlib> | |
#include <iostream> | |
#include <iterator> | |
#include <numeric> | |
#include <stdexcept> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//-------------------------------------------------------------------------- | |
// | |
// Copyright (C) 2011, 2012, 2013 Rhys Ulerich | |
// Copyright (C) 2012, 2013 The PECOS Development Team | |
// Please see http://pecos.ices.utexas.edu for more information on PECOS. | |
// | |
// This Source Code Form is subject to the terms of the Mozilla Public | |
// License, v. 2.0. If a copy of the MPL was not distributed with this | |
// file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//-------------------------------------------------------------------------- | |
// | |
// Copyright (C) 2012, 2013 Rhys Ulerich | |
// Please see http://pecos.ices.utexas.edu for more information on PECOS. | |
// | |
// This Source Code Form is subject to the terms of the Mozilla Public | |
// License, v. 2.0. If a copy of the MPL was not distributed with this | |
// file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
// | |
//-------------------------------------------------------------------------- |