Rewrite only the lines of code that need to be changed so that the above function converts a postfix expression to a prefix expression.
Q: I'm confused on how I would write the shuffle(fname) function so that it returns what it needs to?…
A: We need to write a program that reads a file "fname.txt" and store the data of "fname.txt" file in…
Q: Write a program that tests as many of the math library functions in as you can.Exercise each of…
A: C code: #include<stdio.h> #include <math.h> int main(){ printf("ceil(3.6):\t…
Q: Write a Function in C++ to find swap two numbers that entered by user using pointer .
A: Given:- Write a Function in C++ to find swap two numbers that entered by userusing pointer .
Q: 3. What would happen if you passed in strings instead of integers in the function you created for…
A: <form> <input type = "button" onclick = 'add_four_nums("1","2","3","4")' value =…
Q: Write a function countNonAlnum() that takes a string as parameter, finds and returns the number of…
A: Python offers built in method isalnum() which returns true is string is alphabet or numeric
Q: Language:C Write a function called rightTrimp that trims the digits of the positive integer sent to…
A: Provided the function called rightTrimp that trims the digits of the positive integer sent to it…
Q: Which of the following is correct about a recursive function?
A: A function is a block of statements that can be reused by calling whenever we want
Q: Write a function that takes 2 strings, word1 and word2 as parameters. The function must return if,…
A: In this question, we are asked pass two string in a function and return if second string can be…
Q: Create a function that sorts words by a given string.
A: I have provided PYTHON CODE along with CODE SCREENSHOT and OUTPUT…
Q: Write a function called is_palindrome_ignoring_spaces(string) that takes a string (with spaces) as…
A: Please Indent the code as shown in the given screenshot :
Q: c++, Print out all composite numbers from 2 to 50 using a loop. Within the loop, you must call a…
A: The asked C++ program is coded in the next step with explanatory comments.
Q: In this challenge you should repeat a specific given char x times. Create a function that takes a…
A: function repeat(character, number) { var str = ""; for(var i = 1; i <= number; i++) {…
Q: Write the following function to check whether string s1 is a substring of string s2. The function…
A: Program: // C++ version 14#include <iostream>#include <cstring>using namespace std; //…
Q: Create a function that takes a mathematical expression in prefix notation as a string and evaluates…
A: Algorithm EVALUATE_PREFIX(STRING) Step 1: Put a pointer P at the end of the end Step 2: If…
Q: Write a function in C++ that outputs a string of a character using setfill. Test it 3 times within…
A: Your C++ program is given below as you required with an output.
Q: Computer Science In python, how do I make a function that will initiate a round of a game, in a…
A: The code is given below.
Q: (Yes/No): Does the multiplication operator (*) have a higher precedence than the divisionoperator…
A: Operator precedence: In C++, operator precedence describes the order of operations in a…
Q: Write a program that finds the number of different characters in a character string (text) entered…
A: The approach is to define an array nearly of size of no. of characters in keyboard and initialize it…
Q: I get the following errors for the code above
A: In this question we have to fix and re-write the linked list operations in method using python to…
Q: Write a function that is given two strings as parameters and returns the concatenation of these…
A: The above question is answered in step 2 :-
Q: b. Write a regular expression that specifies the same language that this FSA accepts.
A: Please check the step 2 for regular expression that specifics the same language that this FSA…
Q: Write the in_order() function, which has a list of integers as a parameter, and returns True if the…
A: # returns true if list is sorteddef in_order(test_list): return all(test_list[i] <=…
Q: What will be the output of given code, Explain
A: Coded using C++.
Q: 10. Do Programming Exercise 4 from Chapter 5 using a function acronym (phrase) that returns an…
A: Please refer below for your reference: I have took a string for testing purpose rest all conditions…
Q: write a program in C++ using function that add any two integer numbers.
A: C++ programming is a general purpose, course of action computer programming language supporting…
Q: WAP to find vowels in a string(s1) and concatenate those vowels with string(S2) in uppercase only.…
A: The program is written in java import java.util.Scanner; import java.lang.*;class Main{ public…
Q: Write a C++ function that takes an array and it’s size as parameters,then calculates and returns the…
A: The function is given in the next step that: takes array size and array as input and finds max and…
Q: Write a function that takes two string parameters and their common length. It fills out the second…
A: We have to complete a function "toCapital" which takes two string parameters and their common…
Q: The following function: rpad ('CIT', 5, '.'); would return:
A: Lets see the solution.
Q: Define a function in C++ language that takes an integer n as the parameter and then divides it by 4…
A: Hi there, Please find your solution below, I hope you would find my solution useful and helpful.…
Q: Rewrite the program with alittle bit of changes in this code
A: C programming is a general purpose, course of action computer programming language supporting…
Q: In this challenge you should repeat a specific given char x times. Create a function that takes a…
A: 1. Create a method with two arguments 2. Create new variable repeatedString = ""; 3. Iterate with…
Q: .What is the logical error the following function will incur and why?
A: The code is logically wrong. If you don't balance the stack directly after the 1st recursive call,…
Q: In C++: Write a function which will find the average of all elements of the sequence: {2, 4, 6, 8,…
A: Program Instructions:Create a function that takes the array and the size of an array.In C++, the…
Q: please write a function to reduce blue and green in a picture for JES
A: Given that please write a function to reduce blue and green in a picture for JES You will find that…
Q: Write a short description of each of the following functions: A) strlenB) strcatC) strcpyD)…
A: Note: There are multiple questions are given in one question. According to the rule, you will get…
Q: Do Programming Exercise 4 from Chapter 5 using a function acronym(phrase)that returns an acronym for…
A: Let's see the solution.
Q: Write a program that asks the user to enter a binary string and you must use this binary string as…
A: Algorithm: Start Read a binary string Implement a recursive method binary_to_decimal_1() which takes…
Q: Make an insert function where user can insert value rather than hardcoding it in program in c++
A: C++ program to get the value from the user using the function. Create an insert function. In the…
Q: 5. Write a Python function that takes two paramters. A sentence and a word, then returns the…
A: Python program to solve the given problem, A screenshot of output and code are also attached for…
Q: In this challenge you should repeat a specific given char x times. Create a function that takes a…
A: please check the solution below
Q: Write a recursive function named sumSquares that returns the sum of the squares of the numbers from…
A: code: #include<iostream> #include<cstdlib> using namespace std; //function definition…
Q: Problem 2: Write a function called digitMatch.
A: Approach The function digitMatch will compare the last digits of each integer parameter then compare…
Step by step
Solved in 2 steps with 1 images
- Stacks 1- Write a Python function that takes a user input of a word and returns True if it is a Palindrome and returns False otherwise (Your function should use a Stack data structure). A palindrome is a word that can be read the same backward as forward. Some examples of palindromic words are noon, civic, radar, level, rotor, kayak, reviver, racecar, redder, madam, and refer. 2- Write a Python function that takes a stack of integer numbers and returns the maximum value of the numbers in the stack. The stack should have the same numbers before and after calling the function. 3- Write a main function that tests the functions you wrote in 1 and 2 above and make sure that your code is well documented.For this code, just explain the void pop function, with each and every line. And please provide enough information on how it is working. #include<iostream> using namespace std; int choice, j=0;int stack[50];int *top;bool Exit_Indicator = false; void displayStack() { cout << "\n\t~Stack Display~\nTOP ->"; for (int i = j-1; i >= 0; i--) cout << "\t|\t" << stack[i] << "\t|" << endl; cout << "\t-----------------";} void push(int i){ cout << "\n(" << i << ") has been PUSHED into the stack!"; *top = i; top++; j++;} void pop(){ if((*(top-2) != 0 && *(top-1)!= 0) || (*(top-2) == 0 && *(top-1)!= 0)) { cout << "\n(" << *(top-1) << ") has been POPPED from the stack!"; *(top-1)= 0; top--; j--; } else{ cout<<"\nTHE STACK IS EMPTY";}} int main() { int value; top = stack; do { cout <<…C++ code output must be: Enter series of parentheses: Not Balance! What is the problem of this code? #include <iostream>#include <string>#include <vector>#include <stack>using namespace std; int main(){string x;stack<char, vector<char>> iStack;bool status = true;cout << "Enter series of parentheses: ";getline(cin, x); for (int i = 0; i < x.length(); i++) if (x[i] == '(' || x[i] == '{' || x[i] == '[')iStack.push(x[i]);else{ if (x[i] == ']'){if (iStack.empty() || iStack.top() != '['){return false;}}else if (x[i] == ')'){if (iStack.empty() || iStack.top() != '('){return false;}}else if (x[i] == '}'){if (iStack.empty() || iStack.top() != '{'){return false;}}iStack.pop();} if (iStack.empty())cout << "Balance!" << endl;elsecout << "Not Balance!" << endl;}
- In c++: Bracket Matcher Given a text file, your program will determine if all the parentheses, curly braces, and square brackets match, and are nested appropriately. Your program should work for mathematical formulas and most computer programs. Your program should read in the characters from the file, one at a time, but ignore all characters except for the following: { } ( ) [ ] Your program should use the provided IntStack implementation (IntStack.h and IntStack.cpp). The general algorithm is to use the stack to store the opening unmatched brackets as they are encountered in the input. When a closing bracket is encountered, check it against the one on top of the stack (pop it off)--make sure it matches. When you are finished, if all the brackets match then there should be no unmatched brackets left on the stack. (Note: it might be easier to store the expected closing character on the stack when an opening bracket is encountered; this simplifies the matching when a closing bracket…Ex1: a) Write a function for the user to enter a positive integer n with a value between 10 and 1000. If entered correctly, the function generates a list containing n random values that do not overlap between 1 and 5000 and the function returns the newly created list. Conversely, if entered incorrectly, the program will ask to re-enter until it is correct. Cases where n is considered incorrect:(i)- If the user enters a non-integer data type (like string, float, bool, ...)The program will display the error message 'Must enter a positive integer. Requires re-entry'.(ii)- If the input value is of the correct integer data type but the value is not in the range10 to 1000, the program gives the error 'Only values between 10 and 1000. Re-enter required'.Installation requirements: must use the try ... except statement to handle possible exceptionsin the program. b) Write a function that lists the amicable numbers in the list just created in a) (If there are no amicable numbers in the list,…c++ A palindrome is a string that reads the same both forward and backward. For example, the string "madam" is a palindrome. Write a program that uses a recursive function to check whether a string is a palindrome. Your program must contain a value-returning recursive function that returns true if the string is a palindrome and false otherwise. Do not use any global variables; use the appropriate parameter.
- Using c++: Bracket Matcher Given a text file, your program will determine if all the parentheses, curly braces, and square brackets match, and are nested appropriately. Your program should work for mathematical formulas and most computer programs. Your program should read in the characters from the file, one at a time, but ignore all characters except for the following: { } ( ) [ ] Your program should use the provided IntStack implementation (IntStack.h and IntStack.cpp). The general algorithm is to use the stack to store the opening unmatched brackets as they are encountered in the input. When a closing bracket is encountered, check it against the one on top of the stack (pop it off)--make sure it matches. When you are finished, if all the brackets match then there should be no unmatched brackets left on the stack. (Note: it might be easier to store the expected closing character on the stack when an opening bracket is encountered; this simplifies the matching when a closing…Contact list: Binary Search A contact list is a place where you can store a specific contact with other associated information such as a phone number, email address, birthday, etc. Write a program that first takes as input an integer N that represents the number of word pairs in the list to follow. Word pairs consist of a name and a phone number (both strings). That list is followed by a name, and your program should output the phone number associated with that name. Define and call the following function. The return value of FindContact is the index of the contact with the provided contact name. If the name is not found, the function should return -1 This function should use binary search. Modify the algorithm to output the count of how many comparisons using == with the contactName were performed during the search, before it returns the index (or -1). int FindContact(ContactInfo contacts[], int size, string contactName) Ex: If the input is: 3 Frank 867-5309 Joe 123-5432 Linda…In c++ please. Thank you! A contact list is a place where you can store a specific contact with other associated information such as a phone number, email address, birthday, etc. Write a program that first takes as input an integer N that represents the number of word pairs in the list to follow. Word pairs consist of a name and a phone number (both strings). That list is followed by a name, and your program should output the phone number associated with that name. Define and call the following function. The return value of FindContact is the index of the contact with the provided contact name. If the name is not found, the function should return -1 This function should use linear search. Modify the algorithm to output the count of how many comparisons were performed during the search, before it returns the index (or -1). int FindContact(ContactInfo contacts[], int size, string contactName) Ex: If the input is: 3 Joe 123-5432 Linda 983-4123 Frank 867-5309 Frank the output is:…
- Create a c++ find function that finds a word or phrase within a string. This function should accept the string, and the word or phrase to look for. It should return a list of the character elements where the start of the word/phrase is found in the string. however, this list of elements must be returned as a char* type (not as a string nor individual integers). EX testString) Hello I am Hello Today I am Named John. I like to say Hello. input word string = Hello; find(String, word) //This function call should return 0, 11, 54 because H of Hello is the 0th character, 11th character, and 54th character in testString.n formal language theory and computer programming, string concatenation is the operation of joining character strings end-to-end. For example, the concatenation of "hello" and " world" is "hello world". Write a function in C language. The function name is conscat_strings that takes a char** as a parameter and return a char* Then in the main function we call the conscat_strings function. Assume the maximum input char number is 100, you do not have to calcualte the number of total chars For example, if I compile the file whcih name is homework1.c by using the gcc on the terminal, I just type gcc homework1.c -o homework.out in mac or gcc homework1.c -o homework.exe in windows. Then I am trying to call the outpout, if I only type ./homework1.out, It should give a hint such as please input at least 3 arguments (inlcude ./homework1.out or ./homework1.exe). if I only type ./homework1.out hello It should give a hint such as please input at least 3 arguments (inlcude ./homework1.out or…Expression Conversion Design a program which can tansfer an infix expression into a postfix expression and compute its result. Suppose the infix expression only includes’ *’, ‘/’, ‘+’, ‘-‘, ‘(‘, ‘)’ and the numbers are all integers. [Basic Requirements] 1) You are required to use stack. 2) The infix expression is inputted from keyboard as a string. If the input is legal, please convert the infix expression into postfix expression, calculate the result, and finally output the postfix expression and its value. 3) If the infix expression entered is illegal, the program can prompt the user to input incorrectly and prompt the user to re-enter. Please do the program according to the requirements above and it should be in C language...also after the code i want a report that the algorithm explanations of the code plesse don't just copy other student program and give me back please please please