什么是tolower

核心提示tolower是一种函数,功能是把字母字符转换成小写,非字母字符不做出处理。和函数int _tolower( int c )功能一样,但是_tolower在VC6.0中头文件要用ctype.h。外文名tolower功 能把字母字符转换成小写

最佳答案:

tolower是一种函数,功能是把字母字符转换成小写,非字母字符不做出处理。和函数int _tolower( int c )功能一样,但是_tolower在VC6.0中头文件要用ctype.h。

详情介绍

tolower是一种函数,功能是把字母字符转换成小写,非字母字符不做出处理。和函数int _tolower( int c )功能一样,但是_tolower在VC6.0中头文件要用ctype.h。

外文名
tolower
功 能
把字母字符转换成小写
头文件
在VC6.0可以是ctype.h
用 法
int tolower(int c);

tolower简介

功 能: 把字符转换成小写字母,非字母字符不做出处理

头文件:在VC6.0可以是ctype.h或者stdlib.h,常用ctype.h

目前在头文件iostream中也可以使用,C++ 5.11已证明。

用 法: int tolower(int c);

说明:和函数int _tolower( int c );功能一样,但是_tolower在VC6.0中头文件要用ctype.h

tolowerC程序例

#include<string.h>#include<stdio.h>#include<ctype.h>#include<stdlib.h>int main(){    int i;    char string = "THIS IS A STRING";    printf("%sn", string);    for (i = 0; i < strlen(string); i++)    {        putchar(tolower(string));    }    printf("n");    system("pause");//系统暂停,有助于查看结果}

tolowerC++程序例

#include <iostream>#include <string>#include <cctype>using namespace std;int main(){    string str= "THIS IS A STRING";    for (int i=0; i <str.size(); i++)       str = tolower(str);    cout<<str<<endl;    return 0;}

tolowerC源码示例

//Converts c to its lowercase equivalent if c is an uppercase letter and has a lowercase equivalent.//If no such conversion is possible, the value returned is c unchanged.int tolower (int c){  return (c >= 'A' && c <= 'Z')?(c - 'A' + 'a'):c;}

 
友情链接
鄂ICP备19019357号-22