【C编程练习】华为2013校园招聘机试题目题4:删除一个字符串中出现次数最少的字符,函数原型为:char * delChar(char *s,int iLen)

//ex1_function2.cpp // 源作者:曹玲玲 编于2012-09-12//【题目】华为2013校园招聘机试题目题4:删除一个字符串中出现次数最少的字符,函数原型为:char * delChar(char *s,int iLen) //【输入】s为输入字符串,iLen为输入字符串长度// 如输入字符串为“abcdd”,输出为"dd"//
摘要由CSDN通过智能技术生成
//ex1_function2.cpp 
// 源作者:曹玲玲   编于2012-09-12
//【题目】华为2013校园招聘机试题目题4:删除一个字符串中出现次数最少的字符,函数原型为:char *  delChar(char *s,int iLen) 
//【输入】s为输入字符串,iLen为输入字符串长度
//        如输入字符串为“abcdd”,输出为"dd"
//        字符串中只有小写字母,不含空格且字符串最大长度不超过20  
 
#include <stdio.h>
#include <stdlib.h>
#define MAX 20
//判断字符S是否在字符串visit中,是返回位置,不是返回-1
int whetherInVisit(char s,char* visit)
{
  int i=0;
  while(visit[i]!='\0')
  {
    if (visit[i]==s)
      return i;
    else
      i++;
  }
  return -1;
}
//判断数i,是否是数组array中的最小数,是返回1,不是返回0
int whetherIsMini(unsigned int i,unsigned int * array,unsigned int aLen)
{
  unsigned int temp=0;
  for(temp=0;temp<aLen;temp++)
  {
    if (i>array[temp])
      return 0;
  }
  return 1;
}
char* delChar(char *s,int iLen)
{
  unsigned int Count[MAX];//存放各字符出现的次数
  char v
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 11
    评论
评论 11
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值