Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C program according to the description of Programming Projects Q 2 ( b ) of Chapter 1 2 , on pages 2 7

Write a C program according to the description of Programming Projects Q2(b) of
Chapter 12, on pages 275-276 of the textbook.
Requirements:
- The maximum length of the user message is 100 characters.
- You can only use the [] operator to declare the array. The [] operator should not be
used anywhere else in your program.
- Ignore all characters that arent letters.
- When asked Do you want to continue (N to stop)?, the program stops if the
users input contains n or N.
Example Interaction (user input is underlined; your program must follow this format
precisely without the underline):
$ gcc -Wall a4_palindrome.c
$ ./a.out
Enter a message:
Hello?
Not a palindrome
Do you want to continue (N to stop)? n
$
$ ./a.out
Enter a message: d
Palindrome
Do you want to continue (N to stop)?
z
Enter a message: m
Palindrome
Do you want to continue (N to stop)?
aab
Enter a message: zz
Palindrome
Do you want to continue (N to stop)? y
Enter a message: xy
Not a palindrome
Do you want to continue (N to stop)?
xy
Enter a message: aba
Palindrome
Do you want to continue (N to stop)?
N
$
$ ./a.out
Enter a message: level
Palindrome
Do you want to continue (N to stop)? a
Enter a message: ab!=ba
Palindrome
Do you want to continue (N to stop)? n
$
$ ./a.out
Enter a message: abc
Not a palindrome
Do you want to continue (N to stop)?
y
Enter a message: abcba
Palindrome
Do you want to continue (N to stop)?
a
Enter a message: abceba
Not a palindrome
Do you want to continue (N to stop)?
b
Enter a message: abba
Palindrome
Do you want to continue (N to stop)?
and
$
$ ./a.out
Enter a message: He lived as a devil, eh?
Palindrome
Do you want to continue (N to stop)?
a
Enter a message: Madam, I am Adam.
Not a palindrome
Do you want to continue (N to stop)?
an
$
$ ./a.out
Enter a message: Go ahead, make my day.
Not a palindrome
Do you want to continue (N to stop)? y
Enter a message: Racecar!
Palindrome
Do you want to continue (N to stop)? y
Enter a message: A man, a plan, a canal, Panama!
Palindrome
Do you want to continue (N to stop)?
N
$

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database 10g Insider Solutions

Authors: Arun R. Kumar, John Kanagaraj, Richard Stroupe

1st Edition

0672327910, 978-0672327919

More Books

Students also viewed these Databases questions