[問題] C語言讀檔
看板C_and_CPP (C/C++)作者Presider (President)時間15年前 (2011/04/02 20:44)推噓0(0推 0噓 3→)留言3則, 2人參與討論串2/2 (看更多)
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
#include<stdio.h>
#include<stdlib.h>
void toUpper(char s[]);
int main(void)
{
char str[100];
printf("請輸入字串:");
gets(str);
toUpper(str);
printf("轉成大寫之後:%s\n",str);
return 0;
}
void toUpper(char s[])
{
int i=0;
while(s[i]!='\0')
{
if(s[i]>=97 && s[i]<=122)
s[i]=s[i]-32;
i++;
}
}
請輸入字串:Happy Birthday
轉成大寫之後:HAPPY BIRTHDAY
請問這種鍵盤輸入要怎麼改成讀檔的方式然後轉換大寫?
例如從a.txt讀入Happy Birthday然後轉成HAPPY BIRTHDAY
懇請大家麻煩解決!!!謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 125.231.219.36
→
04/02 20:49, , 1F
04/02 20:49, 1F
→
04/02 23:55, , 2F
04/02 23:55, 2F
→
04/03 00:17, , 3F
04/03 00:17, 3F
討論串 (同標題文章)
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章