返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. #include<string.h>
  4. using namespace std;
  5. int main()
  6. {
  7.     int su=0;
  8.     char st[50];
  9.     cout<<"輸入一字串:";
  10.     cin.getline(st,50);
  11.     for(int i=0;st[i]!=NULL;i++){
  12.             su++;
  13.     }
  14.     cout<<"本字串共包含: "<<su<<" 個字元"<<endl;
  15.     system("pause");
  16.     return 0;   
  17. }
複製代碼

TOP

返回列表