返回列表 發帖

2025/3/14 課堂重點(若恩)

  1. #include <bits/stdc++.h>
  2. using namespace std;

  3. int main(int argc, char** argv) {
  4.     string a, b;
  5.     cin>>a>>b;
  6.     cout<<a.size();
  7.     cout<<b.size();
  8.     string c, c1;
  9.     c=a+b;
  10.     for(int i=c.size();i>=0;i--){
  11.         int j=0;
  12.         c[i]=c1[j];
  13.         j++;
  14.     }
  15.     if(c.size()==c1.size()){
  16.         cout<<c1;
  17.     }
  18.     return 0;
  19.     }
複製代碼

TOP

  1. #include <bits/stdc++.h>
  2. using namespace std;

  3. int main(int argc, char** argv) {
  4.     ifstream ifs;
  5.     ofstream ofs;
  6.     ifs.open("C:\\Users\\student\\Downloads\\read.txt");
  7.     ofs.open("C:\\Users\\student\\Downloads\\write.txt");
  8.     string s;
  9.     getline(ifs, s);
  10.     for(int i=0;i<s.size();i++){
  11.         s[i]=s[i]+2;
  12.     }
  13.     cout<<s<<endl;
  14.     ofs<<s;
  15.     return 0;
  16.     }
複製代碼

TOP

  1. #include <bits/stdc++.h>
  2. using namespace std;

  3. int main(int argc, char** argv) {
  4.     string a;
  5.     cin>>a;
  6.     cout<<stoi(a);
  7.     return 0;
  8.     }
複製代碼

TOP

  1. #include <bits/stdc++.h>
  2. using namespace std;

  3. int main(int argc, char** argv) {
  4.     string a;
  5.     int m=1;
  6.     cin>>a;
  7.     for(int i=0;i<a.size();i++){
  8.         if(i==0){
  9.             m=m*a[i];
  10.             cout<<a[i];
  11.         }else{
  12.             m=m*a[i];
  13.             cout<<"*"<<a[i];
  14.         }
  15.     }
  16.     cout<<"="<<m;
  17.     return 0;
  18.     }
複製代碼

TOP

  1. #include <bits/stdc++.h>
  2. using namespace std;

  3. int main(int argc, char** argv) {
  4.     ifstream ifs;
  5.     ofstream ofs;
  6.     ifs.open("C:\\Users\\student\\Downloads\\read.txt");
  7.     ofs.open("C:\\Users\\student\\Downloads\\write.txt");
  8.     string s;
  9.     getline(ifs, s);
  10.     int n;
  11.     cin>>n;
  12.     string s;
  13.    
  14.     cout<<s<<endl;
  15.     ofs<<s<<endl;
複製代碼

TOP

  1. #include <bits/stdc++.h>
  2. using namespace std;

  3. int main(int argc, char** argv) {
  4.     ifstream ifs;
  5.     ofstream ofs;
  6.     ifs.open("C:\\Users\\student\\Downloads\\read.txt");
  7.     ofs.open("C:\\Users\\student\\Downloads\\write.txt");
  8.     int n;
  9.     cin>>n;
  10.     string s;
  11.     for(int i=1;i<=n;i++){
  12.         getline(ifs, s);
  13.         stringstream ss(s);
  14.         string word;
  15.         string result="";
  16.         while(ss>>word){
  17.             word[0]=toupper(word[0]);
  18.             result+=word+" ";
  19.         }
  20.         cout<<result<<endl;
  21.         ofs<<result<<endl;
  22.     }
  23.     return 0;
  24. }
複製代碼

TOP

返回列表