標題:
2025/1/17 課堂重點(若恩)
[打印本頁]
作者:
郭竑志
時間:
2025-1-17 20:07
標題:
2025/1/17 課堂重點(若恩)
[作業檢查]
310 函式與陣列 (阿姆斯壯數)
[課堂重點]
401 字串與檔案處理 (字串長度與連結)
402 字串與檔案處理 (字串比較)
404 字串與檔案處理 (字母出現次數)
405 字串與檔案處理 (讀取檔案並修改)
406 字串與檔案處理 (判斷字元並修改)
407 字串與檔案處理 (字元刪除及另存新檔)
[今日作業]
403 字串與檔案處理 (字串大小寫轉換)
作者:
何若恩
時間:
2025-1-17 20:34
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
string a, b;
cin>>a>>b;
cout<<a.length()<<endl;
cout<<b.length()<<endl;
cout<<a+b;
return 0;
}
複製代碼
作者:
何若恩
時間:
2025-1-17 20:59
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
char a[100], b[100];
int n, atotal, btotal;
cin>>a>>b>>n;
for(int i=0;i<=a[n];i++){
atotal+=int(a[i]);
}
for(int i=0;i<=b[n];i++){
btotal+=int(b[i]);
}
if(atotal=btotal){
cout<<"atotal=btotal";
}else if(atotal>btotal){
cout<<"atotal>btotal";
}else if(atotal<btotal){
cout<<"atotal<btotal";
}
return 0;
}
複製代碼
作者:
郭竑志
時間:
2025-1-17 21:43
#include<bits/stdc++.h>
using namespace std;
int main()
{
ifstream ifs;
ifs.open("read.txt");
if(!ifs.is_open())
cout<<"error"<<endl;
string s;
int n;
while(ifs>>s)
{
}
}
作者:
何若恩
時間:
2025-2-6 22:22
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
int a;
char word[100];
cin>>word;
a=strlen(word);
for(int i=0;i<a;i++){
if(islower(word[i])){
cout<<(char)toupper(word[i]);
}else if(isupper(word[i])){
cout<<(char)tolower(word[i]);
}else{
cout<<word[i];
}
}
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/)
Powered by Discuz! 7.2