code4sk/c/sourcecode/朱森森带领的奇妙冒险/字符串1/输出大写英文字母.cpp
2023-10-18 16:17:32 +08:00

65 lines
933 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//输出大写英文字母
//本题要求编写程序顺序输出给定字符串中所出现过的大写英文字母每个字母只输出一遍若无大写英文字母则输出“Not Found”。
//输入格式:
//输入为一个以回车结束的字符串少于80个字符
//输出格式:
//按照输入的顺序在一行中输出所出现过的大写英文字母每个字母只输出一遍。若无大写英文字母则输出“Not Found”。
//输入样例1
//FONTNAME and FILENAME
//输出样例1
//FONTAMEIL
//输入样例2
//fontname and filrname
//输出样例2
//Not Found
#include <stdio.h>
#include <string.h>
int main()
{
char a[80];
char b[80];
int i,j,count;
int flag=0;
int n;
int d;
gets(a);
d=strlen(a);
for(i=0;i<d;i++)
{
b[i]=a[i];
}
a[i]=0;
count=0;
for(i=0;a[i]!='\0';i++)
{
flag=0;
if(a[i]>='A'&&a[i]<='Z')
{
for(j=0;j<i;j++)
{
if(b[j]==a[i])
{
flag=1;
}
}
if(flag==0)
{
printf("%c",a[i]);
count++;
}
}
}
if(count==0)
{
printf("Not Found");
}
return 0;
}