This code should be in C eclipse if possible It should also

This code should be in C (eclipse if possible). It should also deplay a \".\" For every second that passes. As it is in the random time delay.

So look something like this.

Example:

Ask for user input

Delays for a random time between 3-7 seconds

Displays \"Give me a sec.\"
.
.
.
.
.
.
(Displays original input forward and backwards)
(Displays if it\'s palindrome)
Design a program that checks whether a string is a palindrome. The string can be several words or just a single word: Acme Palindrome Finder Enter a string to check: Was it a rat I saw? Analyzing input Please wait......... Your input Was it a rat I saw Reverse input was I tar a ti saw Congratulations Palindrome found Minimum Requirements: Your program should pick a random number from 3 to 7 and wait that many seconds before displaying the results. use functions from the time. h library to get the current time. Use a loop to query the system time until the desired number of seconds have passed. The input should not be case sensitive. The program should work with numbers as well as letters. White space is not part of a palindrome, as you can see in the above example.

Solution

#include <stdio.h>
#include<stdlib.h>
#include<time.h>
#include <string.h>

void reverse(char s[]) {
   int c, i , j;
   for (i = 0, j = strlen(s)-1; i < j; i++, j--) {
       c = s[i];
       s[i] = s[j];
       s[j] = c;
   }
   return;
}
void removespaces(char s[]) {
      
   int i,count = 0;

// Traverse the given string. If current character
// is not space, then place it at index \'count++\'
for (i = 0; s[i]; i++)
if (s[i] != \' \')
s[count++] = s[i]; // here count is
// incremented
s[count] = \'\\0\';
  
  
  
  
   return;
}

int main() {
   char a[200];
   char b[200],c[200],d[200];
  
  
   printf(\"Enter a string to check :\");
   fgets(a, sizeof a, stdin);
   delay(5000);
   strcpy(c,a);
   strcpy(d,a);
   reverse(d);
   removespaces(a);
  
  
   strcpy(b,a);
   reverse(a);
  
   printf(\"Your Input : %s\ \",a);
   printf(\"Reverse Input : %s\ \",b);
  
  
   if(strcmp(a, b) == 0) {
      
       printf(\"Congratulations! Palindrome found\ \");
   } else {
       printf(\"The string is not a Palindrome\ \");
   }
   return 0;
}

This code should be in C (eclipse if possible). It should also deplay a \
This code should be in C (eclipse if possible). It should also deplay a \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site