1.用迴圈機構求字串長度。
#include
main(){
char cs[20];
int i=0,lenght=0;
gets(cs);
puts(cs);
while(cs[i++]!='\0')
lenght++;
printf("字串的長度為:%d\n",lenght);
2.編寫程式,統計字串中大寫字母的個數。
#include
main()
char str[20];
int i=0,cnt=0;
gets(str);
puts(str);
while(str[i++]!='\0')
if(str[i]>='a'&&str[i]<='z')
cnt++;
else
cnt+=0;
printf("大寫字母的個數為:%d\n",cnt);
3.編寫程式,去掉字串中所有的星號。
4.編寫程式,將字元陣列a中的字母複製到字元陣列b中,要求每三個字元後插入乙個空格。
5.輸出字串中位置為奇數、ascii為偶數的字元。
第10次作業
clerk.getproduct 從店員處取走整數 class producer implements runnable public void run catch interruptedexception e clerk.setproduct product 將產品交給店員 public clas...
第10次作業
1 統計字串中各數字的長度 2 編寫程式,統計字串中大寫字母的個數 include main char str 50 int i,cnt cnt i 0 gets str while str i 0 if str i a str i z cnt i printf 大寫字母的個數為 d n cnt 3...
第10周作業
1 編寫指令碼selinux.sh,實現開啟或禁用selinux功能 2 統計 etc fstab檔案中每個檔案系統型別出現的次數 awk uuid end etc fstab sort nr 3 提取出字串yd c m05mb 9 bdh7dq yvixp3vpw中的所有數字 echo yd c ...