Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
- #include <stdbool.h>
- /**
- * You need to create a program that retrieves all the uppercase letters from a specific text input.
- * However, if there are no uppercase letters found, the program should print the constant value None.
- * Players must reverse engineer the code to find the original uppercase letters or determine that there are none.
- *
- * Entrée:
- * string
- *
- * Sortie:
- * string
- *
- * Contraintes:
- *
- * Exemple:
- * Entrée:
- * abcdABCD
- * Sortie:
- * ABCD
- */
- int main()
- {
- char s[257];
- scanf("%[^\n]", s);
- int x=0;
- bool f=0;
- char tab[strlen(s)];
- int cpt=0;
- for (int i=0; i<strlen(s); i++) {
- if (s[i] >= 'A' && s[i] <= 'Z' ) {
- tab[cpt++] = s[i];
- f=true;
- }
- }
- if (!f) {
- printf("%s\n", "None");
- } else {
- printf("%s\n", tab);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement