首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

字符串整理解决方法

2012-04-28 
字符串整理Description输入一个字符串,将字符串中所有非英文字母的字符删除后输出。Input多组测试数据,每组

字符串整理
Description

输入一个字符串,将字符串中所有非英文字母的字符删除后输出。 

Input

多组测试数据,每组输入一个以回车结束的字符串。

Output

将这行字符中所有非英文字母的字符删除后输出

Sample Input


I Have 2 MP3.
please you declare the variable m_n_DLength10!
 
Sample Output


IHaveMP
pleaseyoudeclarethevariablemnDLength



我写的代码:
[code=C/C++][/code]#include<stdio.h>
#include<string.h>
int main()
{
  char str[100];
  int i,t;
  while(gets(str)!=NULL)
  {
  t=strlen(str);
  for(i=0;i<t;i++);
  {
  if((str[i]<='z' && str[i]>='a') || (str[i]<='Z' && str[i]>='A'))
  {
  printf("%c",str[i]);
  }
  }
  printf("\n");
  }
  return 0;
}

请问哪里出错了?

[解决办法]
for(i=0;i<t;i++);

去掉这个;

热点排行