herrDeng網內搜尋
自訂搜尋
Ads
訂閱:
張貼留言 (Atom)
熱門文章
-
教育部為提昇全民資安素養與電腦防護能力,本部於101年9月5日至11月5日舉辦「全民資安素養自我評量」活動,請在活動期間內踴躍上網檢測資訊安全素養認知程度,並有機會參與抽獎,詳情請參閱活動網站(網址: https://isafe.moe.edu.tw/event
-
url="https://www.twse.com.tw/exchangeReport/STOCK_DAY?response=json&date=20220330&stockNo=2330"
-
先說明一下這是後知後覺的解答,所謂後知就是股票價格已知存在陣列(清單),當然就要用迴圈練習,雙迴圈暴力解需時O(n**2),當然不用,採python單一迴圈解答「最佳股票的買賣時機#LeetCode 121 Best Time to Buy and Sell Stock」,解...
-
你會用C的算子sizeof?
-
XOR prefixsum CPP python解Leetcode 1829 Maximum XOR for Each Query 其實這裡考慮的是元素個數為2^maximumBit的交換群,運算子為XOR。 [Python code請進]
-
Python C++使用字串find迴圈速解Leetcode 2490 Circular Sentence C++ & Python都有字串的find,用法都類似 split=s.find(' ', split+1)能找到s從index=split+1開...
30 則留言:
#include<iostream>
#include<cstdlib>
#include<string>
#include<algorithm>
using namespace std;
string toUpper(string x){
for (int i = 0; i < x.length(); i++)
if ('a' <= x[i] && x[i] <= 'z')
x[i] = (char)x[i] - 'a' + 'A';
return x;
}
string str_replace (string x, string y, string z){
int e;
while ((e = x.find(y)) != -1)
x.replace(e, y.length(), z);
return x;
}
int main(){
string x = "d@414@gMI";
cout << "cipher=" << x << endl;
x = str_replace(x, "@", "a");
cout << "cipher=" << x << endl;
x = str_replace(x, "14", "這4");
cout << "cipher=" << x << endl;
x = toUpper(x);
cout << "cipher=" << x << endl;
x = str_replace(x, "DA4", "不對");
cout << "cipher=" << x << endl;
x = str_replace(x, "A", "個");
cout << "cipher=" << x << endl;
x = str_replace(x, "GMI", "吉米");
cout << "cipher="<<x << endl;
system("Pause");
return 0;
}
#include<iostream>
#include<cstdlib>
#include<string>
#include<algorithm>
using namespace std;
string toUpper(string x){
for (int i = 0; i < x.length(); i++)
if ('a' <= x[i] && x[i] <= 'z')
x[i] = (char)x[i] - 'a' + 'A';
return x;
}
string str_replace (string x, string y, string z){
int e;
while ((e = x.find(y)) != -1)
x.replace(e, y.length(), z);
return x;
}
int main(){
string x = "d@414@gMI";
cout << "cipher=" << x << endl;
x = str_replace(x, "@", "a");
cout << "cipher=" << x << endl;
x = str_replace(x, "14", "這4");
cout << "cipher=" << x << endl;
x = toUpper(x);
cout << "cipher=" << x << endl;
x = str_replace(x, "DA4", "不對");
cout << "cipher=" << x << endl;
x = str_replace(x, "A", "個");
cout << "cipher=" << x << endl;
x = str_replace(x, "GMI", "吉米");
cout << "cipher="<<x << endl;
system("Pause");
return 0;
}
#include<iostream>
#include<cstdlib>
#include<string>
#include<algorithm>
using namespace std;
string toUpper(string x){
for (int i = 0; i < x.length(); i++)
if ('a' <= x[i] && x[i] <= 'z')
x[i] = (char)x[i] - 'a' + 'A';
return x;
}
string str_replace (string x, string y, string z){
int e;
while ((e = x.find(y)) != -1)
x.replace(e, y.length(), z);
return x;
}
int main(){
string x = "d@414@gMI";
cout << "cipher=" << x << endl;
x = str_replace(x, "@", "a");
cout << "cipher=" << x << endl;
x = str_replace(x, "14", "這4");
cout << "cipher=" << x << endl;
x = toUpper(x);
cout << "cipher=" << x << endl;
x = str_replace(x, "DA4", "不對");
cout << "cipher=" << x << endl;
x = str_replace(x, "A", "個");
cout << "cipher=" << x << endl;
x = str_replace(x, "GMI", "吉米");
cout << "cipher="<<x << endl;
system("Pause");
return 0;
}
#include <iostream>
#include <cstdlib>
#include <string>
using namespace std;
string toUpper(string x){
int n = x.length();
for (int i = 0; i < n; i++)
if ('a' <= x[i] && x[i] <= 'z')
x[i] = x[i] - 'a' + 'A';
return x;
}
string str_replace(string& x, string OLD, string NEW){
int pos;
while ((pos = x.find(OLD)) != -1)
x.replace(pos, OLD.length(), NEW);
return x;
}
int main(){
string x;
getline(cin, x);
cout << x << endl;
x = toUpper(x);
cout << x << endl;
x = str_replace(x, "AB", "就是");
cout << x << endl;
x = str_replace(x, "ab", "不能有小寫");
cout << x << endl;
system("pause");
return 0;
}
#include <iostream>
#include <cstdlib>
#include <string>
using namespace std;
string toUpper(string x){
for (int i = 0; i < x.length(); i++){
if (x[i] >= 'a'&& x[i] <= 'z')
x[i] = x[i] - 'a' + 'A';
}
return x;
}
string str_replace(string x, string OLD, string NEW){
int pos;
while ((pos = x.find(OLD)) != -1){
x = x.replace(pos, OLD.length(), NEW);
}
return x;
}
int main(){
string x = "d@414@gMI";
cout << x << endl;
x = str_replace(x, "@", "a");
cout << x << endl;
x = str_replace(x, "14", "這4");
cout << x << endl;
x = toUpper(x);
cout << x << endl;
x = str_replace(x, "DA4", "不對");
cout << x << endl;
x = str_replace(x, "A", "個");
cout << x << endl;
x = str_replace(x, "GMI", "吉米");
cout << x << endl;
system("pause");
return 0;
}
#include <iostream>
#include <cstdlib>
#include <string>
using namespace std;
string toUpper(string x){
int n = x.length();
for (int i = 0; i < n; i++)
if ('a' <= x[i] && x[i] <= 'z')
x[i] = x[i] - 'a' + 'A';
return x;
}
string str_replace(string& x, string OLD, string NEW){
int pos;
while ((pos = x.find(OLD)) != -1)
x.replace(pos, OLD.length(), NEW);
return x;
}
int main(){
string x;
getline(cin, x);
cout << x << endl;
x = toUpper(x);
cout << x << endl;
x = str_replace(x, "AB", "就是");
cout << x << endl;
x = str_replace(x, "ab", "不能有小寫");
cout << x << endl;
system("pause");
return 0;
}
#include <iostream>
#include <cstdlib>
#include <string>
using namespace std;
string toUpper(string x){
for (int i = 0; i < x.length(); i++){
if (x[i] >= 'a'&& x[i] <= 'z')
x[i] = x[i] - 'a' + 'A';
}
return x;
}
string str_replace(string x, string OLD, string NEW){
int pos;
while ((pos = x.find(OLD)) != -1){
x = x.replace(pos, OLD.length(), NEW);
}
return x;
}
int main(){
string x = "d@414@gMI";
cout << x << endl;
x = str_replace(x, "@", "a");
cout << x << endl;
x = str_replace(x, "14", "這4");
cout << x << endl;
x = toUpper(x);
cout << x << endl;
x = str_replace(x, "DA4", "不對");
cout << x << endl;
x = str_replace(x, "A", "個");
cout << x << endl;
x = str_replace(x, "GMI", "吉米");
cout << x << endl;
system("pause");
return 0;
}
#include <iostream>
#include <cstdlib>
#include <string>
#include <cstring>
using namespace std;
string toUpper(string x){
for (int i = 0; i < x.length(); i++) {
if (x[i] >= 'a' &&x[i] <= 'z')
x[i] = x[i] - 'a' + 'A';
}
return x;
}
string strReplace(string x, string Old, string New){
int pose;
while ((pose = x.find(Old)) != -1)
x.replace(pose,Old.length(),New);
return x;
}
int main()
{
string x;
getline(cin, x);
cout << x << endl;
x = strReplace(x, "@", "a");
cout << x << endl;
x = strReplace(x, "14", "這4");
cout << x << endl;
x = toUpper(x);
cout << x << endl;
x = strReplace(x, "DA4", "不對");
cout << x << endl;
x = strReplace(x, "A", "個");
cout << x << endl;
x = strReplace(x, "GMI", "吉米");
cout << x << endl;
system("Pause");
return 0;
}
#include <iostream>
#include <cstdlib>
#include <string>
#include <cstring>
using namespace std;
string toUpper(string x){
for (int i = 0; i < x.length(); i++){
if (x[i] >= 'a' && x[i] <= 'z')
x[i] = (char)x[i] - 'a' + 'A';
}
return x;
}
string str_replace(string x, string OLD, string NEW){
int pos;
while ((pos = x.find(OLD)) != -1){
x = x.replace(pos, OLD.length(), NEW);
}
return x;
}
int main()
{
string x;
getline(cin, x);
cout << x << endl;
cout << x.length() << endl;
x=str_replace(x, "@", "a");
cout << x << endl;
cout << x.length() << endl;
x = str_replace(x, "14", "這4");
cout << x << endl;
cout << x.length() << endl;
x = toUpper(x);
cout << x << endl;
cout << x.length() << endl;
x = str_replace(x, "DA4", "不對");
cout << x << endl;
cout << x.length() << endl;
x = str_replace(x, "A", "個");
cout << x << endl;
cout << x.length() << endl;
x = str_replace(x, "GMI", "吉米");
cout << x << endl;
cout << x.length() << endl;
system("Pause");
return 0;
}
#include<iostream>
#include<cstdlib>
#include<string>
#include<cstring>
using namespace std;
string toUpper(string x){
for (int i = 0; i < x.length(); i++){
if (x[i] >= 'a'&& x[i] <= 'z')
x[i] = x[i] - 'a' + 'A';
}
return x;
}
string strReplace(string x, string Old, string New){
int pose;
while ((pose = x.find(Old)) != -1)
x.replace(pose, Old.length(),New);
return x;
}
int main()
{
string x;
getline(cin, x);
cout << x << endl;
x = strReplace(x, "@", "a");
cout << x << endl;
x = strReplace(x, "14", "這4");
cout << x << endl;
x = toUpper(x);
cout << x << endl;
x = strReplace(x, "DA4", "不對");
cout << x << endl;
x = strReplace(x, "A", "個");
cout << x << endl;
x = strReplace(x, "GMI", "吉米");
cout << x << endl;
system("Pause");
return 0;
}
#include <iostream>
#include <cstdlib>
#include <string>
#include <cstring>
using namespace std;
string toUpper(string x){
for (int i = 0; i < x.length(); i++){
if (x[i] >= 'a'&& x[i] <= 'z')
x[i] = x[i] - 'a' + 'A';
}
return x;
}
string str_replace(string x, string OLD, string NEW){
int pos;
while ((pos = x.find(OLD)) != -1){
x = x.replace(pos, OLD.length(), NEW);
}
return x;
}
int main()
{
string x;
getline(cin, x);
cout << x << endl;
x = toUpper(x);
cout << x << endl;
cout << x.length() << endl;
x = str_replace(x, "@", "a");
cout << x << endl;
cout << x.length() << endl;
x = str_replace(x, "14", "這4");
cout << x << endl;
cout << x.length() << endl;
x = toUpper(x);
cout << x << endl;
cout << x.length() << endl;
x = str_replace(x, "DA4", "不對");
cout << x << endl;
cout << x.length() << endl;
x = str_replace(x, "A", "個");
cout << x << endl;
cout << x.length() << endl;
x = str_replace(x, "GMI", "吉米");
cout << x << endl;
cout << x.length() << endl;
system("Pause");
return 0;
}
#include <iostream>
#include <cstdlib>
#include <string>
#include <cstring>
using namespace std;
string toUpper(string x){
for (int i = 0; i < x.length(); i++){
if (x[i] >= 'a'&& x[i] <= 'z')
x[i] = x[i] - 'a' + 'A';
}
return x;
}
string str_replace(string x, string OLD, string NEW){
int pos;
while ((pos = x.find(OLD)) != -1){
x = x.replace(pos, OLD.length(), NEW);
}
return x;
}
int main()
{
string x;
getline(cin, x);
cout << x << endl;
x = toUpper(x);
cout << x << endl;
cout << x.length() << endl;
x = str_replace(x, "@", "a");
cout << x << endl;
cout << x.length() << endl;
x = str_replace(x, "14", "這4");
cout << x << endl;
cout << x.length() << endl;
x = toUpper(x);
cout << x << endl;
cout << x.length() << endl;
x = str_replace(x, "DA4", "不對");
cout << x << endl;
cout << x.length() << endl;
x = str_replace(x, "A", "個");
cout << x << endl;
cout << x.length() << endl;
x = str_replace(x, "GMI", "吉米");
cout << x << endl;
cout << x.length() << endl;
system("Pause");
return 0;
}
#include &lt;iostream&gt;
#include &lt;cstdlib&gt;
#include &lt;string&gt;
#include &lt;cstring&gt;
using namespace std;
string toUpper(string x){
for (int i = 0; i &lt; x.length(); i++){
if (x[i] &gt;= 'a'&amp;&amp; x[i] &lt;= 'z')
x[i] = x[i] - 'a' + 'A';
}
return x;
}
string str_replace(string x, string OLD, string NEW){
int pos;
while ((pos = x.find(OLD)) != -1){
x = x.replace(pos, OLD.length(), NEW);
}
return x;
}
int main()
{
string x;
getline(cin, x);
cout &lt;&lt; x &lt;&lt; endl;
x = toUpper(x);
cout &lt;&lt; x &lt;&lt; endl;
cout &lt;&lt; x.length() &lt;&lt; endl;
x = str_replace(x, "@", "a");
cout &lt;&lt; x &lt;&lt; endl;
cout &lt;&lt; x.length() &lt;&lt; endl;
x = str_replace(x, "14", "&#36889;4");
cout &lt;&lt; x &lt;&lt; endl;
cout &lt;&lt; x.length() &lt;&lt; endl;
x = toUpper(x);
cout &lt;&lt; x &lt;&lt; endl;
cout &lt;&lt; x.length() &lt;&lt; endl;
x = str_replace(x, "DA4", "&#19981;&#23565;");
cout &lt;&lt; x &lt;&lt; endl;
cout &lt;&lt; x.length() &lt;&lt; endl;
x = str_replace(x, "A", "&#20491;");
cout &lt;&lt; x &lt;&lt; endl;
cout &lt;&lt; x.length() &lt;&lt; endl;
x = str_replace(x, "GMI", "&#21513;&#31859;");
cout &lt;&lt; x &lt;&lt; endl;
cout &lt;&lt; x.length() &lt;&lt; endl;
system("Pause");
return 0;
}
#include<iostream>
#include<cstdlib>
#include<string>
#include<cstring>
using namespace std;
string toUpper(string x){
int n = x.length();
for (int i = 0; i < n; i++)
if ('a' <= x[i] && x[i] <= 'z')
x[i] = (char)x[i] - 'a' + 'A';
return x;
}
string strReplace(string x, string old, string New){
int pose;
while ((pose = x.find(old)) != -1)
x.replace(pose, old.length(), New);
return x;
}
int main()
{
string x;
getline(cin, x);
cout << x << endl;
x = strReplace(x, "@", "a");
cout << x << endl;
x = strReplace(x, "14", "這4");
cout << x << endl;
x = toUpper(x);
cout << x << endl;
x = strReplace(x, "DA4", "不對");
cout << x << endl;
x = strReplace(x, "A", "個");
cout << x << endl;
x = strReplace(x, "GMI", "吉米");
cout << x << endl;
system("Pause");
return 0;
}
#include
#include
#include
#include
using namespace std;
string toUpper(string x){
for (int i = 0; i < x.length(); i++) {
if (x[i] >= 'a' &&x[i] <= 'z')
x[i] = x[i] - 'a' + 'A';
}
return x;
}
string strReplace(string x, string Old, string New){
int pose;
while ((pose = x.find(Old)) != -1)
x.replace(pose,Old.length(),New);
return x;
}
int main()
{
string x;
getline(cin, x);
cout << x << endl;
x = strReplace(x, "@", "a");
cout << x << endl;
x = strReplace(x, "14", "這4");
cout << x << endl;
x = toUpper(x);
cout << x << endl;
x = strReplace(x, "DA4", "不對");
cout << x << endl;
x = strReplace(x, "A", "個");
cout << x << endl;
x = strReplace(x, "GMI", "吉米");
cout << x << endl;
system("Pause");
return 0;
}
#include
#include
#include
#include
using namespace std;
string toUpper(string x){
for (int i = 0; i < x.length(); i++) {
if (x[i] >= 'a' &&x[i] <= 'z')
x[i] = x[i] - 'a' + 'A';
}
return x;
}
string strReplace(string x, string Old, string New){
int pose;
while ((pose = x.find(Old)) != -1)
x.replace(pose,Old.length(),New);
return x;
}
int main()
{
string x;
getline(cin, x);
cout << x << endl;
x = strReplace(x, "@", "a");
cout << x << endl;
x = strReplace(x, "14", "這4");
cout << x << endl;
x = toUpper(x);
cout << x << endl;
x = strReplace(x, "DA4", "不對");
cout << x << endl;
x = strReplace(x, "A", "個");
cout << x << endl;
x = strReplace(x, "GMI", "吉米");
cout << x << endl;
system("Pause");
return 0;
}
#include
#include
#include
#include
using namespace std;
string toUpper(string x){
for (int i = 0; i < x.length(); i++) {
if (x[i] >= 'a' &&x[i] <= 'z')
x[i] = x[i] - 'a' + 'A';
}
return x;
}
string strReplace(string x, string Old, string New){
int pose;
while ((pose = x.find(Old)) != -1)
x.replace(pose,Old.length(),New);
return x;
}
int main()
{
string x;
getline(cin, x);
cout << x << endl;
x = strReplace(x, "@", "a");
cout << x << endl;
x = strReplace(x, "14", "這4");
cout << x << endl;
x = toUpper(x);
cout << x << endl;
x = strReplace(x, "DA4", "不對");
cout << x << endl;
x = strReplace(x, "A", "個");
cout << x << endl;
x = strReplace(x, "GMI", "吉米");
cout << x << endl;
system("Pause");
return 0;
}
#include
#include
#include
#include
using namespace std;
string toUpper(string x){
for (int i = 0; i < x.length(); i++) {
if (x[i] >= 'a' &&x[i] <= 'z')
x[i] = x[i] - 'a' + 'A';
}
return x;
}
string strReplace(string x, string Old, string New){
int pose;
while ((pose = x.find(Old)) != -1)
x.replace(pose,Old.length(),New);
return x;
}
int main()
{
string x;
getline(cin, x);
cout << x << endl;
x = strReplace(x, "@", "a");
cout << x << endl;
x = strReplace(x, "14", "這4");
cout << x << endl;
x = toUpper(x);
cout << x << endl;
x = strReplace(x, "DA4", "不對");
cout << x << endl;
x = strReplace(x, "A", "個");
cout << x << endl;
x = strReplace(x, "GMI", "吉米");
cout << x << endl;
system("Pause");
return 0;
}
#include
#include
#include
#include
using namespace std;
string toUpper(string x){
for (int i = 0; i < x.length(); i++) {
if (x[i] >= 'a' &&x[i] <= 'z')
x[i] = x[i] - 'a' + 'A';
}
return x;
}
string strReplace(string x, string Old, string New){
int pose;
while ((pose = x.find(Old)) != -1)
x.replace(pose,Old.length(),New);
return x;
}
int main()
{
string x;
getline(cin, x);
cout << x << endl;
x = strReplace(x, "@", "a");
cout << x << endl;
x = strReplace(x, "14", "這4");
cout << x << endl;
x = toUpper(x);
cout << x << endl;
x = strReplace(x, "DA4", "不對");
cout << x << endl;
x = strReplace(x, "A", "個");
cout << x << endl;
x = strReplace(x, "GMI", "吉米");
cout << x << endl;
system("Pause");
return 0;
}
#include
#include
#include
#include
using namespace std;
string toUpper(string x){
for (int i = 0; i < x.length(); i++) {
if (x[i] >= 'a' &&x[i] <= 'z')
x[i] = x[i] - 'a' + 'A';
}
return x;
}
string strReplace(string x, string Old, string New){
int pose;
while ((pose = x.find(Old)) != -1)
x.replace(pose,Old.length(),New);
return x;
}
int main()
{
string x;
getline(cin, x);
cout << x << endl;
x = strReplace(x, "@", "a");
cout << x << endl;
x = strReplace(x, "14", "這4");
cout << x << endl;
x = toUpper(x);
cout << x << endl;
x = strReplace(x, "DA4", "不對");
cout << x << endl;
x = strReplace(x, "A", "個");
cout << x << endl;
x = strReplace(x, "GMI", "吉米");
cout << x << endl;
system("Pause");
return 0;
}
#include
#include
#include
#include
using namespace std;
string toUpper(string x){
for (int i = 0; i < x.length(); i++) {
if (x[i] >= 'a' &&x[i] <= 'z')
x[i] = x[i] - 'a' + 'A';
}
return x;
}
string strReplace(string x, string Old, string New){
int pose;
while ((pose = x.find(Old)) != -1)
x.replace(pose,Old.length(),New);
return x;
}
int main()
{
string x;
getline(cin, x);
cout << x << endl;
x = strReplace(x, "@", "a");
cout << x << endl;
x = strReplace(x, "14", "這4");
cout << x << endl;
x = toUpper(x);
cout << x << endl;
x = strReplace(x, "DA4", "不對");
cout << x << endl;
x = strReplace(x, "A", "個");
cout << x << endl;
x = strReplace(x, "GMI", "吉米");
cout << x << endl;
system("Pause");
return 0;
}
B10233137
#include
#include
#include
#include
using namespace std;
string toUpper(string x){
for (int i = 0; i < x.length(); i++)
if ('a' <= x[i] && x[i] <= 'z')
x[i] = (char)x[i] - 'a' + 'A';
return x;
}
string str_replace(string x, string y, string z){
int e;
while ((e = x.find(y)) != -1)
x.replace(e, y.length(), z);
return x;
}
int main(){
string x = "d@414@gMI";
cout << "cipher=" << x << endl;
x = str_replace(x, "@", "a");
cout << "cipher=" << x << endl;
x = str_replace(x, "14", "這4");
cout << "cipher=" << x << endl;
x = toUpper(x);
cout << "cipher=" << x << endl;
x = str_replace(x, "DA4", "不對");
cout << "cipher=" << x << endl;
x = str_replace(x, "A", "個");
cout << "cipher=" << x << endl;
x = str_replace(x, "GMI", "吉米");
cout << "cipher=" << x << endl;
system("Pause");
return 0;
}
B10233137
#include
#include
#include
#include
using namespace std;
string toUpper(string x){
for (int i = 0; i < x.length(); i++)
if ('a' <= x[i] && x[i] <= 'z')
x[i] = (char)x[i] - 'a' + 'A';
return x;
}
string str_replace(string x, string y, string z){
int e;
while ((e = x.find(y)) != -1)
x.replace(e, y.length(), z);
return x;
}
int main(){
string x = "d@414@gMI";
cout << "cipher=" << x << endl;
x = str_replace(x, "@", "a");
cout << "cipher=" << x << endl;
x = str_replace(x, "14", "這4");
cout << "cipher=" << x << endl;
x = toUpper(x);
cout << "cipher=" << x << endl;
x = str_replace(x, "DA4", "不對");
cout << "cipher=" << x << endl;
x = str_replace(x, "A", "個");
cout << "cipher=" << x << endl;
x = str_replace(x, "GMI", "吉米");
cout << "cipher=" << x << endl;
system("Pause");
return 0;
}
B10233127
#include
#include
#include
#include
using namespace std;
string toUpper(string x){
for (int i = 0; i < x.length(); i++)
if ('a' <= x[i] && x[i] <= 'z')
x[i] = (char)x[i] - 'a' + 'A';
return x;
}
string str_replace(string x, string y, string z){
int e;
while ((e = x.find(y)) != -1)
x.replace(e, y.length(), z);
return x;
}
int main(){
string x = "d@414@gMI";
cout << "cipher=" << x << endl;
x = str_replace(x, "@", "a");
cout << "cipher=" << x << endl;
x = str_replace(x, "14", "這4");
cout << "cipher=" << x << endl;
x = toUpper(x);
cout << "cipher=" << x << endl;
x = str_replace(x, "DA4", "不對");
cout << "cipher=" << x << endl;
x = str_replace(x, "A", "個");
cout << "cipher=" << x << endl;
x = str_replace(x, "GMI", "吉米");
cout << "cipher=" << x << endl;
system("Pause");
return 0;
}
#include #include #include #include using namespace std; string toUpper(string x){ int n = x.length(); for (int i = 0; i <n; i++) if ('a' <= x[i] && x[i] <= 'z') x[i] = (char)x[i] - 'a' + 'A'; return x; } string strReplace(string x, string old, string New){ int pose; while ((pose = x.find(old)) != -1) x.replace(pose, old.length(), New); return x; } int main() { string x; getline(cin ,x); cout << x << endl; x = toUpper(x); cout << x << endl; x = strReplace(x,"@", "A"); cout << x << endl; x = strReplace(x, "14", "這4"); cout << x << endl; x = strReplace(x, "DA4", "不對"); cout << x << endl; x = strReplace(x, "A", "個"); cout << x << endl; x = strReplace(x, "GMI", "吉米"); cout << x << endl; system("Pause"); return 0; }
#include
#include
#include
#include
using namespace std;
string toUpper(string x){
for (int i = 0; i < x.length(); i++) {
if (x[i] >= 'a' &&x[i] <= 'z')
x[i] = x[i] - 'a' + 'A';
}
return x;
}
string strReplace(string x, string Old, string New){
int pose;
while ((pose = x.find(Old)) != -1)
x.replace(pose,Old.length(),New);
return x;
}
int main()
{
string x;
getline(cin, x);
cout << x << endl;
x = strReplace(x, "@", "a");
cout << x << endl;
x = strReplace(x, "14", "這4");
cout << x << endl;
x = toUpper(x);
cout << x << endl;
x = strReplace(x, "DA4", "不對");
cout << x << endl;
x = strReplace(x, "A", "個");
cout << x << endl;
x = strReplace(x, "GMI", "吉米");
cout << x << endl;
system("Pause");
return 0;
}
#include
#include
#include
#include
using namespace std;
string toUpper(string x){
for (int i = 0; i < x.length(); i++) {
if (x[i] >= 'a' &&x[i] <= 'z')
x[i] = x[i] - 'a' + 'A';
}
return x;
}
string strReplace(string x, string Old, string New){
int pose;
while ((pose = x.find(Old)) != -1)
x.replace(pose,Old.length(),New);
return x;
}
int main()
{
string x;
getline(cin, x);
cout << x << endl;
x = strReplace(x, "@", "a");
cout << x << endl;
x = strReplace(x, "14", "這4");
cout << x << endl;
x = toUpper(x);
cout << x << endl;
x = strReplace(x, "DA4", "不對");
cout << x << endl;
x = strReplace(x, "A", "個");
cout << x << endl;
x = strReplace(x, "GMI", "吉米");
cout << x << endl;
system("Pause");
return 0;
}
#include<iostream>
#include<cstdlib>
#include<string>
#include<algorithm>
using namespace std;
string toUpper(string x){
for (int i = 0; i < x.length(); i++)
if ('a' <= x[i] && x[i] <= 'z')
x[i] = (char)x[i] - 'a' + 'A';
return x;
}
string str_replace(string x, string y, string z){
int a;
while ((a = x.find(y)) != -1)
x.replace(a, y.length(), z);
return x;
}
int main(){
string x = "d@414@gMI";
cout << "cipher=" << x << endl;
x = str_replace(x, "@", "a");
cout << "cipher=" << x << endl;
x = str_replace(x, "14", "這4");
cout << "cipher=" << x << endl;
x = toUpper(x);
cout << "cipher=" << x << endl;
x = str_replace(x, "DA4", "不對");
cout << "cipher=" << x << endl;
x = str_replace(x, "A", "個");
cout << "cipher=" << x << endl;
x = str_replace(x, "GMI", "吉米");
cout << "cipher=" << x << endl;
system("Pause");
return 0;
}
#include<iostream>
#include<cstdlib>
#include<string>
#include<algorithm>
using namespace std;
string toUpper(string x){
for (int i = 0; i < x.length(); i++)
if ('a' <= x[i] && x[i] <= 'z')
x[i] = (char)x[i] - 'a' + 'A';
return x;
}
string str_replace (string x, string y, string z){
int e;
while ((e = x.find(y)) != -1)
x.replace(e, y.length(), z);
return x;
}
int main(){
string x = "d@414@gMI";
cout << "cipher=" << x << endl;
x = str_replace(x, "@", "a");
cout << "cipher=" << x << endl;
x = str_replace(x, "14", "這4");
cout << "cipher=" << x << endl;
x = toUpper(x);
cout << "cipher=" << x << endl;
x = str_replace(x, "DA4", "不對");
cout << "cipher=" << x << endl;
x = str_replace(x, "A", "個");
cout << "cipher=" << x << endl;
x = str_replace(x, "GMI", "吉米");
cout << "cipher="<<x << endl;
system("Pause");
return 0;
}
#include
#include
#include
#include
using namespace std;
string toUpper(string x){
for (int i = 0; i < x.length(); i++)
if ('a' <= x[i] && x[i] <= 'z')
x[i] = (char)x[i] - 'a' + 'A';
return x;
}
string str_replace (string x, string y, string z){
int e;
while ((e = x.find(y)) != -1)
x.replace(e, y.length(), z);
return x;
}
int main(){
string x = "d@414@gMI";
cout << "cipher=" << x << endl;
x = str_replace(x, "@", "a");
cout << "cipher=" << x << endl;
x = str_replace(x, "14", "這4");
cout << "cipher=" << x << endl;
x = toUpper(x);
cout << "cipher=" << x << endl;
x = str_replace(x, "DA4", "不對");
cout << "cipher=" << x << endl;
x = str_replace(x, "A", "個");
cout << "cipher=" << x << endl;
x = str_replace(x, "GMI", "吉米");
cout << "cipher="<<x << endl;
system("Pause");
return 0;
}
張貼留言