Answer:
a) # include <iostream>
# include <conio.h>
# include <stdio.h>
# include <string.h>
using namespace::std;
bool IsPalindrome(const string& str)
{
if (str.empty())
return false;
int i = 0; // first characters
int j = str.length() - 1; // last character
while (i < j)
{
if (str[i] != str[j])
{
return false;
}
i++;
j--;
}
return true;
}
int main()
{
string str;
cout<<"Enter the string";
getline(cin, str);
bool a= IsPalindrome(str);
if(a)
{
cout<<"Is in palindrome";
}
else
{
cout<<"Is not in palindrome";
}
}
b) Modified version of function with full program to discard uppercase or lowercase is as below:
# include <iostream>
# include <conio.h>
# include <stdio.h>
# include <string.h>
using namespace::std;
bool IsPalindrome(const string& str)
{
if (str.empty())
return false;
int i = 0; // first characters
int j = str.length() - 1; // last character
while (i < j)
{
char a= tolower(str[i]);
char b= tolower(str[j]);
if (a != b)
{
return false;
}
i++;
j--;
}
return true;
}
int main()
{
string str;
cout<<"Enter the string";
getline(cin, str);
bool a= IsPalindrome(str);
if(a)
{
cout<<"Is in palindrome";
}
else
{
cout<<"Is not in palindrome";
}
}
Explanation:
Please check the answer section.
Answer:
The execution resumes in the finally block if one exists or otherwise from the next statement following the try...catch block.
Explanation:
Once an exception has been thrown and caught in the code, the execution continues with the statements in the finally block if one exists. If there is no finally block defined then execution resumes from the next statement following the try... catch block. For example:
try{
//An exception is raised
}
catch (Exception e){
//Exception is handled
}
System.out.println("After try...catch");
In this code segment, the next statement to be executed after catch is the System.out.println();
Answer: It was the Ed Sullivan show.
Explanation:
Hi,The Doors were about to perform their hit “light my fire “ on The Ed Sullivan Show on Sept. 17, 1967.
But with 15 minutes until air time, a producer from the show went to the band’s dressing room and asked them to change the word “higher” for “better” in the line “Girl, we couldn't get much higher” from the song.
When performing Morrison sang the original lines, and the band resulted banned from the show.
Answer:
a line graph
Explanation:
I think so . hope this helps