報錯提示:運算式必須包含型別別
#include<iostream>
#include<math.h>
#include<string.h>
#include<algorithm>
using namespace std;
int main() {
char str[100];
cin >> str;
int i;
for (i = 0;i < strlen(str - 1);i++) {
if (str[i] == str[i + 1]) {
str.erase(str[i]);
}
}
}
uj5u.com熱心網友回復:
字符陣列沒有 erase 成員方法,需要自己移動元素來處理。要不然你就用string類或vecter<char>來代替陣列
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/139071.html
標籤:C++ 語言
上一篇:HALCON匯出C#,if (HDevWindowStack.IsOpen()) 這個判斷陳述句條件無法成立為什么?
