Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //palindromeround2
- #include <stdio.h>
- #include <stdlib.h>
- #define MAX_CHARACTER 4096
- int caseShifter(int input);
- int evenPalindromeTest(char input[]);
- int oddPalindromeTest(char input[]);
- int filterLengthCounter(char input[]);
- int main(void) {
- char inputArray[MAX_CHARACTER] = {0};
- char filteredArray[MAX_CHARACTER] = {0};
- int arrayCounter = 0;
- int filterCounter = 0;
- int shiftedCase;
- int filterLength;
- printf("Enter a string: ");
- inputArray[arrayCounter] = getchar();
- while(arrayCounter < MAX_CHARACTER && inputArray[arrayCounter] != '\n') {
- if('a' <= inputArray[arrayCounter] && inputArray[arrayCounter] <= 'z'){
- filteredArray[filterCounter] = inputArray[arrayCounter];
- filterCounter = filterCounter + 1;
- }
- else if('A' <= inputArray[arrayCounter] && inputArray[arrayCounter] <= 'Z'){
- shiftedCase = caseShifter(inputArray[arrayCounter]);
- filteredArray[filterCounter] = shiftedCase;
- filterCounter = filterCounter + 1;
- }
- arrayCounter = arrayCounter + 1;
- inputArray[arrayCounter] = getchar();
- }
- filterLength = filterLengthCounter(filteredArray);
- printf("%d\n", filterLength);
- return 0;
- }
- int caseShifter(int input){
- int output;
- output = input + 32;
- return output;
- }
- int evenPalindromeTest(char input[]){
- int output = 0;
- return output;
- }
- int oddPalindromeTest(char input[]){
- int output = 0;
- return output;
- }
- int filterLengthCounter(char input[]){
- int counter = 0;
- int length = 0;
- while (counter != '\n'){
- counter = counter + 1;
- }
- length = counter;
- return length;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement