Experiment 7-3-5 Output uppercase English letters (15 points)

This question requires writing a program to sequentially output the uppercase English letters that have appeared in a given string, and output each letter only once; if there is no uppercase English letter, output "Not Found".

Input format:
input as a string (less than 80 characters) ending with a carriage return.

Output format:
Output the uppercase English letters that have appeared in one line in the order of input, and output each letter only once. If there is no uppercase English letter, output "Not Found".

Input sample 1:
FONTNAME and FILENAME
output sample 1:
FONTAMEIL
input sample 2:
fontname and filrname
output sample 2:
Not Found
title collection complete works portal

#include <stdio.h>
#include <string.h>
int main()
{
    
    
    char a[81], c[81];
    int flag1 = 0, flag2 = 0, count = 0;
    gets(a);
    for (int i = 0; i < strlen(a); i++)
        if (a[i] >= 'A' && a[i] <= 'Z')
        {
    
    
            flag2 = 1;
            for (int j = 0; j < count; j++)
                if (c[j] == a[i])
                    flag1 = 1;
            if (flag1 == 0)
            {
    
    
                c[count] = a[i];
                printf("%c", a[i]);
                count++;
            }
            flag1 = 0;
        }
    if (flag2 == 0)
        printf("Not Found");

    return 0;
}

Guess you like

Origin blog.csdn.net/fjdep/article/details/112947370