第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

c++,tolower函數(shù)功能實(shí)現(xiàn)?

c++,tolower函數(shù)功能實(shí)現(xiàn)?

縹緲止盈 2019-02-04 15:06:15
#include<iostream>#include<string>#include<cctype>using namespace std;int main(){string s1;cin>>s1;cout<<tolower(s1)<<endl;return 0;} [Error] error: no matching function for call to `tolower(std::string&)'[Warning] note: candidates are: int tolower(int)我就是想試試這個(gè)函數(shù)的功能,也包含了頭文件cctype,哪里出錯(cuò)了呢
查看完整描述

2 回答

?
慕俠2389804

TA貢獻(xiàn)1719條經(jīng)驗(yàn) 獲得超6個(gè)贊

tolower函數(shù),就是把大寫字母轉(zhuǎn)成小寫字母。

為了使函數(shù)更健壯,可以在入口處添加對(duì)參數(shù)范圍的判斷,只對(duì)大寫字母操作。

由于函數(shù)功能簡(jiǎn)單,所以tolower最好設(shè)置為內(nèi)聯(lián)函數(shù)(inline)。

代碼如下:

123456inline char tolower(char c){    if(c >= 'A' && c<='Z')//是大寫字母,執(zhí)行轉(zhuǎn)換。        c+='a'-'A';//轉(zhuǎn)成大寫。    return c;}


查看完整回答
反對(duì) 回復(fù) 2019-03-19
  • 2 回答
  • 0 關(guān)注
  • 551 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)