[問題] c++用副程式大小寫轉換
不好意思,c++新手,指標副程式方面還不是很熟
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
C++
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
問題(Question):
如何將字串傳到副程式?並且有點看不出這錯誤是什麼意思。
餵入的資料(Input):
預期的正確結果(Expected Output):
錯誤結果(Wrong Output):
cannot convert 'std::string' to 'char*' for argument '1' to 'char' strlwr(char*)
程式碼(Code):(請善用置底文網頁, 記得排版)
#include<iostream>
#include<cstdlib>
using namespace std;
void stringlower(string sentence);
int main()
{
int i, x;
int j = 1;
int k = 0;
char sentence[50000];
cout<<"請輸入要轉換的英文"<<endl;
cin.getline(sentence,50000);
for(i = 0; i<j; k++ )
{
cout<<"如果要轉換成全部大寫,請按1"<<endl;
cout<<"如果不再做另外的修改,請按5"<<endl;
cin >> x;
if (x == 1)
stringlower(sentence);
else
i = 2;
}
system("pause");
return 0;
}
void stringlower(string sentence)
{
strlwr(sentence);
cout<<"轉換大寫:"<<sentence<<endl;
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 120.126.67.223
→
12/27 08:54, , 1F
12/27 08:54, 1F
→
12/27 08:54, , 2F
12/27 08:54, 2F
→
12/27 08:55, , 3F
12/27 08:55, 3F
→
12/28 04:01, , 4F
12/28 04:01, 4F