返回列表 發帖

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

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

TOP

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

  3. int main(int argc, char** argv) {
  4.     string str1="qwertyuiopasdfghjklzxcvbnm";
  5.     string str2="wertyuioppsdfghjkllxcvbnmm";
  6.     string s;
  7.     while(cin>>s){
  8.         for(int i=0;i<s.size();i++){
  9.             int index;
  10.             index=str1.find(s[i]);
  11.             cout<<str2[index];
  12.         }
  13.     }
  14.     return 0;
  15. }
複製代碼

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(1)");
  7.     ofs.open("C:\\Users\\student\\Downloads\\write.txt");
  8.     string s;
  9.     getline(cin,s);
  10.     while(cin>>s){
  11.         for(int i=0;i<s.size();i++){
  12.             if(s[i]=='*')
  13.             continue;
  14.             ofs<<s[i];
  15.         }
  16.     }
  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.     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

返回列表