[YTU]_1985( C语言实验——保留字母)
2017-06-01 10:57
225 查看
编一个程序,输入一个字符串,将组成字符串的所有非英文字母的字符删除后输出。 Input 一个字符串,长度不超过80个字符。 Output 删掉非英文字母后的字符串。 Sample Input abc123+xyz.5 Sample Output abcxyz
#include <iostream> #include <cstring> using namespace std; int main() { char str[81],str1[81]; int i,n=0; gets(str); for(i=0;str[i]!='\0';i++) { if((str[i]>='a'&&str[i]<='z')||(str[i]>='A'&&str[i]<='Z')) { str1 =str[i]; n++; } } str1 ='\0'; cout<<str1<<endl; return 0; }
相关文章推荐
- ytu 1985:C语言实验——保留字母(水题)
- ytu 1985:C语言实验——保留字母
- 山东理工OJ 1162 C语言实验——保留字母
- C语言实验——保留字母
- SDUT-1162-->C语言实验——保留字母
- C语言实验——保留字母
- SDUT-1162 C语言实验——保留字母
- SDUT ACM 实验九 C语言实验——保留字母
- C语言实验——保留整数 (sdut oj)
- YTU 2016: C语言实验——打印金字塔(打印图形)
- 1171 C语言实验——保留整数
- C语言实验——保留字母 (sdut oj)
- C语言实验——保留字母
- C语言实验——保留字母
- ytu 2011: C语言实验——找中间数(水题)
- ytu 1998:C语言实验——删除指定字符
- C语言实验——保留字母
- oj1949: C语言实验——转换字母(顺序结构)
- oj1979: C语言实验——用*号输出字母C的图案
- ytu 2029: C语言实验——温度转换(水题)