C语言题目有一种情况结果是错误的帮忙看看吧谢谢啊

[复制链接]
查看11 | 回复4 | 2012-4-25 12:54:41 | 显示全部楼层 |阅读模式
#include "stdio.h"#include "string.h"void main(){
int i,j,k=0,len1,len2;
char s[80],t[80],u[80];
gets(s);
gets(t);
len1=strlen(s);
len2=strlen(t);
for(i=0;i<len1;i++)
{
for(j=0;j<len2;j++)
if(s==t[j]) {s=0;break;} /*查到有重复的话赋予0*/
}
for(i=0;i<len...
回复

使用道具 举报

千问 | 2012-4-25 12:54:41 | 显示全部楼层
用如下双层循环即可:void main(){
char s[80],t[80],u[80];
int i,j,k=0,num=0,m=0,n=0;
gets(s);
gets(t);for(j=0;s[j]!='\0';j++){for(i=0;t!='\0';i++){if(s[j]=...
回复

使用道具 举报

千问 | 2012-4-25 12:54:41 | 显示全部楼层
运行了下你的程序是正确的,没错啊...
回复

使用道具 举报

千问 | 2012-4-25 12:54:41 | 显示全部楼层
你说的那种情况是错误的?...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行