qq_31481531 2015-11-15 15:29 采纳率: 0%
浏览 1774

菜鸟级C语言问题,求帮助~

Petya started to attend programming lessons. On the first lesson his task was to write a simple program. The program was supposed to do the following: in the given string, consisting if uppercase and lowercase Latin letters, it:

deletes all the vowels,
inserts a character "." before each consonant,
replaces all uppercase consonants with corresponding lowercase ones.

Vowels are letters "A", "O", "Y", "E", "U", "I", and the rest are consonants. The program's input is exactly one string, it should return the output as a single string, resulting after the program's processing the initial string.

Help Petya cope with this easy task.
Input

The first line represents input string of Petya's program. This string only consists of uppercase and lowercase Latin letters and its length is from 1 to 100, inclusive.
Output

Print the resulting string. It is guaranteed that this string is not empty.
Sample test(s)
input

tour

output

.t.r

input

Codeforces

output

.c.d.f.r.c.s

input

aBAcAba

output

.b.c.b

我的答案:
#include
#include

int main()
{
char a[100];
int length,i;
scanf("%s",&a);
length=strlen(a);
for(i=1;i<=length;i++)
{
if(a[i]=='a'||a[i]=='A'||a[i]=='o'||a[i]=='O'||a[i]=='y'||a[i]=='Y'||a[i]=='e'||a[i]=='E'||a[i]=='u'||a[i]=='U'||a[i]=='i'||a[i]=='I')
{
break;
}
else
{
if(a[i]>=65&&a[i]<=90)
{
printf(".%c",a[i]+32);
}
else if(a[i]>=97&&a[i]<=122)
{
printf(".%c",a[i]);
}

    }

}


printf("\n");
return 0;

}

求指点,哪里错了,跪谢!

  • 写回答

4条回答 默认 最新

  • threenewbee 2015-11-15 15:45
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥30 python代码,帮调试,帮帮忙吧