herrDeng網內搜尋
自訂搜尋
Ads
訂閱:
張貼留言 (Atom)
熱門文章
-
計算你的BMI
-
1. 利用遞迴input n算2^n 2. 用C算GCD(3333,456)
-
請用 C/C++/java寫一簡易程式
-
需要練習的Java程式:
-
33, 45, 87, 99, 27 算平均
-
BMI (Body Mass Index)= 體重 (kg) / 身高 ^2(m 2 ) 在台灣,行政院衛生署乃根據其相關研究,於2002年4月公佈台灣成人肥胖標準: BMI<18.5 為過輕, 18.5≦BMI<24 為正常體重, 24≦BMI<27 為過重, BM...
-
一、 試利用switch case由程式中直接輸入一個1~7 之間的整數day,代表星期一到星期日。若day 的值是1,則印出 "星期一",若day 的值是2,則印出 "星期二",若day 的值是7,則印出 "星期日",...
-
用 C/C++算上學期加權平均
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;
}
張貼留言