1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
MAXImum [283]
3 years ago
13

Write a program that uses the function isPalindrome given below. Test your program on the following strings: madam, abba, 22, 67

876, 444244, trymeuemyrt. Modify the function isPalindrome given so that when determining whether a string is a palindrome, cases are ignored, that is, uppercase and lowercase letters are considered the same. bool isPalindrome(string str)
{
int length = str.length();

for (int i = 0; i < length / 2; i++)
{
if (str[i] != str[length - 1 - i] )
return false;
}

return true;
}
Engineering
1 answer:
defon3 years ago
5 0

Answer:

#include <iostream>

#include <string>

using namespace std;

bool isPalindrome(string str)

{

   int length = str.length();

   for (int i = 0; i < length / 2; i++)

   {

       if (tolower(str[i]) != tolower(str[length - 1 - i]))

           return false;

   }

   return true;

}

int main()

{

   string s[6] = {"madam", "abba", "22", "67876", "444244", "trymeuemyrt"};

   int i;

   for(i=0; i<6; i++)

   {

       //Testing function

       if(isPalindrome(s[i]))

       {

           cout << "\n " << s[i] << " is a palindrome... \n";

       }

       else

       {

           cout << "\n " << s[i] << " is not a palindrome... \n";

       }

   }    

       

   return 0;

}

You might be interested in
Is santa real or nah is santa real or nah
Elena L [17]

Answer:

nah

Explanation:

3 0
3 years ago
Read 2 more answers
The tolerance for a geometric can be easily identified by reading the _________.
baherus [9]

Answer:

C

Explanation:

4 0
3 years ago
Read 2 more answers
Turn on your____
storchak [24]

Answer:

b

Explanation:

5 0
3 years ago
Read 2 more answers
You have a motor such that if you give it 12 Volt, it will eventually reach a steady state speed of 200 rad/s. If it starts from
Aleksandr [31]

Answer:

a) \frac{Ws}{Es}  = \frac{200}{1+1.2s}

b) attached below

c) type zero system

d) k > \frac{g}{200}

e) The gain K increases above % error as the  steady state speed increases

Explanation:

Given data:

Motor voltage  = 12 v

steady state speed = 200 rad/s

time taken to reach 63.2% = 1.2 seconds

<u>a) The transfer function of the motor from voltage to speed</u>

let ; \frac{K1}{1+St} be the transfer function of a motor

when i/p = 12v then steady state speed ( k1 ) = 200 rad/s , St ( time constant ) = 1.2 sec

hence the transfer function of the motor from voltage to speed

= \frac{Ws}{Es}  = \frac{200}{1+1.2s}

<u>b) draw the block diagram of the system with plant controller and the feedback path </u>

attached below is the remaining part of the detailed solution

c) The system is a type-zero system because the pole at the origin is zero

d) ) k > \frac{g}{200}

7 0
3 years ago
Define an ADT for a two-dimensional array of integers. Specify precisely the basic operations that can be performed on such arra
VashaNatasha [74]

Answer:

Explanation:

ADT for an 2-D array:

struct array{

int arr[10];

}arrmain[10];

An application that stores an array with 1000 rows and 1000 columns, where less than 10,000 of the array values are non-zero. The two different implementations for such arrays that would be more space efficient than a standard two-dimensional array implementation requiring one million positions are :

1) struct array{

int *p;

}arr[1000];

2) struct array{

int *p;

}arr[1000];

6 0
3 years ago
Other questions:
  • Look at the data set below.
    15·2 answers
  • Who tryna play fortnite with me
    11·2 answers
  • Give a reason why fighter aircraft use mid-wing design.
    11·1 answer
  • Question 9 of 25
    12·1 answer
  • Do you think the mining process is faster when you know in advance that the land must be restored? Explain.
    14·1 answer
  • Suppose we want to determine how many of the bits in a twelve-bit unsigned number are equal to zero. Implement the simplest circ
    14·1 answer
  • Acoke can with inner diameter(di) of 75 mm, and wall thickness (t) of 0.1 mm, has internal pressure (pi) of 150 KPa and is suffe
    9·1 answer
  • What building codes did Mega Corporation fail to follow?
    9·1 answer
  • In a stream channel, the total volume of water flowing through a cross-section of stream is _______.
    9·1 answer
  • What is voltage drop?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!