Write a function that receives a string of characters as its input, and check if it is symmetric to a dollar sign. You may use following function header: bool isInLanguage_1(string aString) 2. Write a function that receives a string of characters and return true if the string is in language, otherwise it returns false. You may use following function header (Assume a string is in language if it is read from the left side is the same as it is read from the right side. For example, a-b-d-c is not in the language, a-b-c-a-c-b-a is in language): bool isInLanguage_2(string aString
1. Write a function that receives a string of characters as its input, and check if it is symmetric to a dollar sign. You may use following function header:
bool isInLanguage_1(string aString)
2. Write a function that receives a string of characters and return true if the string is in language, otherwise it returns false. You may use following function header (Assume a string is in language if it is read from the left side is the same as it is read from the right side. For example, a-b-d-c is not in the language, a-b-c-a-c-b-a is in language):
bool isInLanguage_2(string aString)
I tried using a while loop, but for some reason, I am not getting the output I was hoping for and would like you to check this out.
![gint main() {
Stack<char> char_stack;
string contained_str;
cout « "Enter a string with $ sign: ";
<<
getline( &: cin, &: contained_str);
int i = 0;
while(contained_str[i] != '\®'){
cout « contained_str[i] « endl;
char_stack.push(contained_str[i]);
i++;
char_stack.isInLanguage_1(contained_str);
return 0;](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F346b36e0-a4d8-47d7-8bd1-1ad776cb1cf3%2F6983a501-4a7d-4468-aad9-42b0c2409eb1%2Fi0pwraq_processed.png&w=3840&q=75)
![template <class ItemType>
bool Stack<ItemType>::isInLanguage_1(const string &containing_str) {
if (isEmpty()){
cout « "It is empty here!" « endl;
return false;
else{
if (items[containing_str] == '$'){
top--;
return true;
return false;](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F346b36e0-a4d8-47d7-8bd1-1ad776cb1cf3%2F6983a501-4a7d-4468-aad9-42b0c2409eb1%2Fivrw9fs_processed.png&w=3840&q=75)

Trending now
This is a popular solution!
Step by step
Solved in 5 steps with 2 images









