


删除所有的小写字符'a',程序运行之后总是缺少题目要求中的空格,求帮忙调一下程序,怎么实现题目要求?
哈哈, 讲真的, 你这方法算是投机取巧了, 不删除直接输出不带a的字符串, 刷题应该能过
#include <iostream>
using namespace std;
int main(){
string str;
cout << "please input a character string:" << endl;
getline(cin, str);
cout << "the result after delete 'a' is:" << endl;
for(int i = 0; str[i] != '\0'; i++){
if (str[i] != 'a')
cout << str[i];
}
}