输出字符串中没有重复的字符,比如“baaca”,则会输出“bac”

原来打算用hash直接对应,但是那样会把顺寻改变。下面给出两个程序,一个用hash,一个不是:请大家分析

//输入一个字符串中没有重复的字符如“abbbc”输出abc
void Repeat_to_Signal(char *s)
{
	int hash[50],index;
	memset(hash,0,sizeof(hash));
	for (int i=0;i<strlen(s);i++)
	{
		int index=s[i]-'A';
		hash[index]++;
	}
	for (i=0;i<50;i++)
	{
		if (hash[i]!=0)
		{
			printf("%c",i+'A');
		}
	}
}
void Repeat_to_Singal1(char *s)
{
	int temp[256],k=0,*p,j;
	memset(temp,'\0',sizeof(temp));
	temp[k++]=s[0];
	for (int i=0;i<strlen(s);i++)
	{
		for (j=0,p=temp;j<256;j++,p++)
		{
			if (s[i]==temp[j]) //如果有重复则直接跳出来
			{
				break;
			}
			if (*p=='\0') //如果进行到末尾,还没找到相同的则说明,前面的没有这个字符。直接在尾部添加
			{
				temp[k++]=s[i];
				break;
			}

		}
	}
	for (p=temp;*p!='\0';p++)
	{
		printf("%c",*p);
	}
}


 

根据你提供的安装命令,出现以下报错,请分析是什么原因,需要如何解决: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、付费专栏及课程。

余额充值