Skip to content

Files

Latest commit

2475cbd · Jul 22, 2024

History

History
22 lines (18 loc) · 516 Bytes

C++删除数字字符.md

File metadata and controls

22 lines (18 loc) · 516 Bytes

在这里插入图片描述

#include <iostream>
#include <cstring>
using namespace std;

int main()
{
	int n=0;
	char a[31],b[31];
	cin.getline(a,31);

	for(int i=0; i<strlen(a); i++) {
		if(a[i]>='0'&&a[i]<='9') n++;
		else cout<<a[i];
	}
	cout<<endl<<n<<endl;
	return 0;
}