登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

秒大刀 博客

好好学习 天天向上

 
 
 

日志

 
 
 
 

Upper  

2006-04-13 01:20:24|  分类: C/C++ |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

//问题描述:  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;
}

  评论这张
 
阅读(817)| 评论(0)

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018