编辑代码

#include <iostream>
using namespace std;
int main() {
    //JSRUN引擎2.0,支持多达30种语言在线运行,全仿真在线交互输入输出。
    int length = 10; 
    int a[length] = {0,1,2,0,3,0,0,4,5,0};
    int k=0,item = 0;
    for(int i=0;i<length;i++){
        if(a[i]==item)
            k++;
        else
            a[i-k] = a[i];
    }
    length-=k;
    cout<<k<<endl;
    for(int i = 0;i<length;i++)
        cout<<a[i]<<endl;
	cout << "Hello world!    - cpp.jsrun.net." << endl;
	return 0;
}