//问题描述: Write a function upper that is passed a string argument by reference and converts
// the lowercase letters to uppercase. Characters that are not lowercase letters are
// unchanged.
//备注:
//作者: 杨明哲
//完成日期:
//BUG报告; dearymz@163.com
#ifndef TOUPPER_H
#define TOUPPER_H
#include <string>
#include <stdlib.h>
namespace ymz
{
void upper(std::string& str)
{
for(unsigned int i = 0; i < str.length(); i++)
{
str[i] = toupper(str[i]);
}
}
}
#endif
//-------------------------------
#include "toupper.h"
#include <iostream>
using namespace std;
void main()
{
string str = "123abcdefgABCDEFG000";
cout<<str<<endl;
ymz::upper(str);
cout<<str<<endl;
}
评论