首页 > 其他 > 详细

(5)实现一个函数,把一个字符串中的字符从小写转为大写。

时间:2016-02-29 10:41:19      阅读:218      评论:0      收藏:0      [点我收藏+]

#include "stdio.h"
#include "conio.h"
#include "stdafx.h"
#include <iostream>
using namespace std;

void upper(char* s, char* us)
{
while(*s != ‘\0‘)
{
if(*s >= ‘a‘ && *s <= ‘z‘)
{
*us = *s - 32;
}
else
{
*us = *s;
}
s++;
us++;
}
*us = ‘\0‘;//注意不要漏了这一句
}

int main()
{
char A[20],B[20];
printf("Please input a string:\n");
scanf_s("%s", A, 20);
upper(A,B);
printf("%s", B);
system("pause");
}

(5)实现一个函数,把一个字符串中的字符从小写转为大写。

原文:http://www.cnblogs.com/qingfengshuimu/p/5226602.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!