標題:
2024/11/30 冠毅
[打印本頁]
作者:
郭竑志
時間:
2024-11-30 13:53
標題:
2024/11/30 冠毅
本帖最後由 郭竑志 於 2024-12-7 13:28 編輯
[作業檢查]
打字練習網
中打練習:舉一反三、後生可畏、原來如此、體驗魯凱生活
函式的建立與執行 (四)
硬幣投擲模擬
[課程重點]
進位制
ASCII 編碼系統
Unicode 編碼系統
substr() 函式
replace() 函式
字串處理 (一)
字串處理 (二) - 字串輸入 1
字串處理 (三) - 字串輸入 2
字串處理 (五) - 英文大小寫轉換
字串處理 (六) - 取得字串長度 1
字串處理 (七) - 取得字串長度 2
字串處理 (八) - 將字串轉換為ASCII碼
[今日作業]
字串處理 (四) - 字串中第n個字母為何
字串處理 (九) - 將ASCII碼轉換為字串
字串處理 (十) - 判斷大小寫
作者:
劉冠毅
時間:
2024-11-30 14:54
#include<iostream>
#include<cstdlib>
#include<string>
using namespace std;
int main()
{
string a;
getline(cin,a);
cout<<a;
system("pause");
return 0;
}
複製代碼
作者:
劉冠毅
時間:
2024-11-30 14:59
#include<iostream>
#include<cstdlib>
#include<string>
using namespace std;
int main()
{
char a[50];
cin.getline(a,50);
cout<<a;
system("pause");
return 0;
}
複製代碼
作者:
劉冠毅
時間:
2024-11-30 15:16
#include<iostream>
#include<cstdlib>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
string a;
cin>>a;
transform(a.begin(),a.end(),a.begin(),::toupper);
cout<<a;
transform(a.begin(),a.end(),a.begin(),::tolower);
cout<<endl;
cout<<a;
system("pause");
return 0;
}
複製代碼
作者:
劉冠毅
時間:
2024-12-7 13:39
#include<iostream>
#include<cstdlib>
#include<string>
using namespace std;
int main()
{
int i;
char a[50];
cout<<"請輸入任意一串英文字串";
cin.getline(a,50);
cout<<"抓出第幾個字母";
cin>>i;
cout<<"字串的第"<<i<<"個字母:" <<a[i-1];
system("pause");
return 0;
}
複製代碼
作者:
劉冠毅
時間:
2024-12-7 13:44
#include<iostream>
#include<cstdlib>
#include<string>
#include <algorithm>
using namespace std;
int main()
{
int s;
int e;
char str[127];
cout<<"起始值" ;
cin>>s;
cout<<"終止值";
cin>>e;
for (int i = s; i<=e; i++){
cout<< char(i);
}
system("pause");
return 0;
}
複製代碼
作者:
劉冠毅
時間:
2024-12-7 13:46
#include<iostream>
#include<cstdlib>
#include<string>
#include <algorithm>
using namespace std;
int main()
{
int n;
char str[100];
cout<<"輸入任意字元<100字以內>";
cin.getline(str, 100);
for (int i=1;i<=int(str[127]);i++){
cout<<"第"<<i<<"個字元的ASCII碼為"<<int(str[i]);
if(int(str[i])<int(str[41]) and int(str[i])>str[90]){
cout<<"大寫";
}else if(int(str[i])<int(str[61]) and int(str[i])>str[122]){
cout<<"小寫";
}else{
cout<<"該字元不是英文字母";
}
}
system("pause");
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/)
Powered by Discuz! 7.2