百度笔试题
来源:互联网 发布:人工智能能否取代人类 编辑:程序博客网 时间:2024/06/06 14:02
int maxContinuNum(const char *inputstr,char * outputstr)
{
bool flag=false;
char *cur=NULL;
char *p=(char *)inputstr;
int len=0;
int maxLen=0;
while(*p)
{
if((*p>='0')&&(*p<='9')&&!flag)
{
flag=true;
cur=p;
}
if(*p>='0'&&*p<='9')
len++;
else
{
flag=false;
len=0;
}
if(len>maxLen)
{
maxLen=len;
outputstr=cur;
}
p++;
}
//cout<<maxLen<<endl;
//cout<<*outputstr<<endl;
return maxLen;
}
1、公司技术部接到一个任务,需要使用a-z、0-9组成3位的字符密码,现请你设计一个算法,将可能的密码组合全部打印出来。(10分)
#include<stdio.h>
#include<stdlib.h>
void main()
{
//cout<<midnum(a,b,0,1,0,1)<<endl;
FILE *fp=fopen("test.txt","w");
for(int i=0;i<36;i++)
for(int j=0;j<36;j++)
{
for(int k=0;k<36;k++)
{
if(i>=0&&i<=9)
fprintf(fp,"%d",i);
else
fprintf(fp,"%c",i+87);
if(j>=0&&j<=9)
fprintf(fp,"%d",j);
else
fprintf(fp,"%c",j+87);
if(k>=0&&k<=9)
fprintf(fp,"%d ",k);
else
fprintf(fp,"%c ",k+87);
}
fprintf(fp,"\n");
}
fclose(fp);
}
2、请实现字符串反转函数。
void myreverse(char *str)
{
char *p,*q;
p=str;
while(*p)
q=p++;
p=str;
while(p<q)
{
char t=*p;
*p++=*q;
*q--=t;
}
}
void main()
{
char str[]="yanzhengfei";
cout<<str<<endl;
myreverse(str);
cout<<str<<endl;
}
- 百度网上笔试题
- 百度网上笔试题
- 百度网上笔试题
- 百度笔试题
- 百度网上笔试题
- 百度笔试题
- 2006百度笔试题
- 百度网上笔试题
- 百度笔试题
- 2007百度笔试题
- 百度笔试题 [软件工程师]
- 百度笔试题
- 2007百度笔试题
- 百度部分笔试题
- 08百度笔试题
- 08百度笔试题
- 百度笔试题
- 百度笔试题 [软件工程师]
- 邂逅在华灯初上
- 伪静态设置更灵活 多种伪静态 可同时访问
- arm-linux-gcc4.4.3安装
- 模板中支持三元运算 不能用点
- css实现div内容垂直居中
- 百度笔试题
- like和notlike查询支持数组方式 更方便了,不像以前那么繁琐
- 14岁初中生—— 踏踏实实的人生也最美
- 在数据中增加安全方法 filter 模型类增加filter连贯操作
- hibernate第二章:关联映射3
- 百度面试题——用C语言实现函数void * memmove(void *dest,const void *src,size_t n)
- 增加表单提交字段合法性检测 弱爆了的方法 ,一直想用来着
- 网页设计精粹:网页中那些迷人的按钮设计
- 等你,执手渡流年(七夕)