#include <stdio.h>
#include <string.h> #define Num 1000 int main()
{
int c,i,j = 0,m = 0,n = 0,k,count1 = 0,count2 = 0,w,h = 0,l = 0,flag2 = 0;
char s[Num],t[Num],str[Num] = {'\0'};
int number[Num],number2[Num],flag = 0; printf("Please input a string:\n"); while((c = getchar()) != EOF && c != '\n' && count1 < Num)
{
s[count1] = c;
count1++;
} printf("Please input another string:\n"); while((c = getchar()) != EOF && c != '\n' && count2 < Num)
{
t[count2] = c;
count2++;
} for(i = 0;i < count1;i++)
{
flag = 0; for(k = 0;k < m;k++)
{
if(s[i] == str[k])
{
flag = 1;
break;
}
} if(flag == 0)
{
for(j = 0;j < count2;j++)
{
if(s[i] == t[j])
{
str[m++] = s[i];
number[n++] = i;
number2[h++] = j;
break;
}
}
}
}
printf("The first location in str1 where any character from str2 occurs\n"); for(w = 0;w < count2;w++)
{
flag2 = 0; for(l = 0;l < m;l++)
{
if(w == number2[l])
{
printf("%c",str[l]);
printf(",%d\n",number[l]);
flag2 = 1;
break;
}
}
if(flag2 == 0)
printf("%c,-1\n",t[w]); } return 0;
}

费了好大劲,完成期间错误百出!要仔细点啊。

最新文章

  1. 冰球项目日志1-yjw
  2. sqlServer数据库插入数据后返回刚插入记录的自增ID
  3. 【CImg】霍夫变换——直线检测
  4. C#之数据分页
  5. soapUI 使用Property
  6. Ubuntu 14.04下java开发环境的搭建--3--Tomcat及MySQL的安装
  7. 【MySQL】使用 Optimizer Trace 观察SQL执行过程
  8. laravel5 事务回滚
  9. Codeforce E. Fire
  10. Winform退出运行后,删除运行目录(批处理方法)
  11. 【死磕 Spring】----- IOC 之 加载 Bean
  12. javascript高级程序设计第3版——第8章 BOM(浏览器对象模型)
  13. Thinkphp5多数据库切换
  14. Java使用HTTPClient4.3开发的公众平台消息模板的推送功能
  15. 将本地光盘做成yum源
  16. 基于jquery结婚电子请柬特效素材
  17. 让网站和APP更具动感的几点建议
  18. mysql 数据操作 单表查询 练习
  19. [BZOJ4311]向量(凸包+三分+线段树分治)
  20. JMeter常用元器件

热门文章

  1. 【整理】PHP获取客户端真实IP地址详解
  2. 【CodeBase】PHP将数组键名转成变量名
  3. flask项目实战--论坛
  4. C语言指针篇(一)指针与指针变量
  5. poj 1957 二分搜索
  6. The Image Gallery Revisited
  7. 把实体bean对象转换成DBObject工具类
  8. 编译IOS下 libpcap1.7.2
  9. Android学习记录(9)—Android之Matrix的用法
  10. 将有效慢日志转存到数据库v2