输出一个字符串中没有重复的字符。如“baaca”输出“bac”

504 篇文章 0 订阅
// 输出一个字符串中没有重复的字符.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "string.h"

//1 输出一个字符串中没有重复的字符。如“baaca”输出“bac”。

void trimMultipleCharacter(char *array)
{
	char table[256] = {0};

	int size = strlen(array);

	for (int i=0; i<size; i++)
	{
		table[array[i]]++;
	}

	char *pCopy, *pCur;

	pCopy = pCur = &array[0];

	while(*pCur != '\0')
	{
		if (table[*pCur] > 0)
		{
			table[*pCur] = 0;
			*pCopy++ = *pCur++;
		}
		else
		{
			pCur++;
		}
	}
	*pCopy = '\0';

}

int _tmain(int argc, _TCHAR* argv[])
{
	char Array[] = {"aadbccddecffegdabghkiikkkk"};

	trimMultipleCharacter(Array);

	printf("%s", Array);

	return 0;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
根据你提供的安装命令,出现以下报错,请分析是什么原因,需要如何解决:C:\Users\Administrator>pip install pysqlcipher3 Collecting pysqlcipher3 Using cached pysqlcipher3-1.2.0.tar.gz (102 kB) Preparing metadata (setup.py) ... done Building wheels for collected packages: pysqlcipher3 Building wheel for pysqlcipher3 (setup.py) ... done WARNING: Legacy build of wheel for 'pysqlcipher3' created no files. Command arguments: 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\python.exe' -u -c ' exec(compile('"'"''"'"''"'"' # This is <pip-setuptools-caller> -- a caller that pip uses to run setup.py # # - It imports setuptools before invoking setup.py, to enable projects that directly # import from `distutils.core` to work with newer packaging standards. # - It provides a clear error message when setuptools is not installed. # - It sets `sys.argv[0]` to the underlying `setup.py`, when invoking `setup.py` so # setuptools doesn'"'"'t think the script is `-c`. This avoids the following warning: # manifest_maker: standard file '"'"'-c'"'"' not found". # - It generates a shim setup.py, for handling setup.cfg-only projects. import os, sys, tokenize try: import setuptools except ImportError as error: print( "ERROR: Can not execute `setup.py` since setuptools is not available in " "the build environment.", file=sys.stderr, ) sys.exit(1) __file__ = %r sys.argv[0] = __file__ if os.path.exists(__file__): filename = __file__ with tokenize.open(__file__) as f: setup_py_code = f.read() else: filename = "<auto-generated setuptools caller>" setup_py_code = "from setuptools import setup; setup()" exec(compile(setup_py_code, filename, "exec")) '"'"''"'"''"'"' % ('"'"'C:\\Users\\Administrator\\AppData\\Local\\Temp\\pip-install-kpw5ylk5\\pysqlcipher3_64cff8baaca94d668d7efe41a1e57482\\setup.py'"'"',), "<pip-setuptools-caller>", "exec"))' bdist_wheel -d 'C:\Users\Administrator\AppData\Local\Temp\pip-wheel-kj2j7asn' Command output: [use --verbose to show] Running setup.py clean for pysqlcipher3 Failed to build pysqlcipher3 ERROR: Could not build wheels for pysqlcipher3, which is required to install pyproject.toml-based projects
最新发布
06-09
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值