Given: string s; int first, last; Write code to repeatedly validate that first is less than last and both first and last are valid indexes of the string s. Then print all characters of the string s from index first to last inclusive. Example Output 1 Enter a string and two indexes: Queensborough 2 5 eens Example Output 2 Enter a string and two indexes: Science 2 10 Enter a string and two indexes: Science -15 Enter a string and two indexes: Science 2 4 ien
Q: #include using namespace std; int main() { string c_name ; string car_n; int n, member_n ,…
A: In your program code after input the service number from the user, you need to assign the charges…
Q: main.cpp - Code:Blocks 20.03 File Edit View Search Project Build Debug Fortran wxSmith Tools Tools+…
A: The error is in line 52. It should be ( update line 52 with ) : if (…
Q: Turn this into a flowchart/pseudo code.
A: Summary Pseudocode is a sequence of simplified steps used to solve a problem by implementing in a…
Q: File: Money.asm #3 Author: ************ Date: mm/dd/yyyy # Purpose: Practice floating point; Break…
A: Given C++ code, File: Money.asmAuthor: ************Date: mm/dd/yyyyPurpose: Practice floating point;…
Q: Character data stored in a variable data1. what will be the output of the following code?…
A: Given a python statement, print("Sorted data are: ",sort(data1))
Q: Using this code: 1. How many double entries can aValues[MAX_A] store? 2. How many char entries can…
A: Here according to our guideline i Solve first three: ================================== Answer 1:…
Q: c++ int * board; int rows; int columns; cout > columns >> rows; cout << endl; board= new…
A: Arrays are basically of 2 types:1. Static arrays.2. Dynamic arrays. Static arrays:- Array in…
Q: Complete the isInt() function which returns true if a token can be converted to an int and false…
A: Algorithm: Start Read a string Pass that string to isInt method Inside the method create a…
Q: 29. A calorie is a unit of energy. The 15°C calorie is defined as 4.1855 Joules. The following…
A: Normally we know that, the one small calorie is equal to the 4.184 joules. the by using this we can…
Q: In this lab, you use what you have learned about searching an array to find an exact match to…
A: #include <iostream>#include <string>using namespace std; int main() { string…
Q: MichiganCities.cpp - This program prints a message for invalid cities in Michigan. // Input:…
A: Start declare inCity declare constant NUM_CITIES = 10 declare citiesInMichigan[] = {"Acme",…
Q: What is stored in score1, score2, and grade? 0 Integer score1 - 72; int score2-85; Character grade -…
A: Given lines of code are, Integer score1 = 72; int score2 = 85; Character grade = 'C'; It contains…
Q: C++ part 4: I have these error i am missing the ExecuteMenu Function This is my code so far.…
A: Given: C++ part 4: I have these error i am missing the ExecuteMenu Function This is my code so…
Q: Error Message: error: 'stoi' was not declared in this scope price=stoi(token);
A: ->stoi function will not work for C++11 below version. Make sure your compiler settings are…
Q: 1- If the following lines of code have errors, correct them; otherwise, write "no errors." double…
A: According to the Bartleby rules, we are answering the first 3 questions as these are separate…
Q: Write a program to copy one string to another using pointer. Write a program to concatenate two…
A: Here we have to write programs using pointers : we have to write 3 programs 1 Write a program to…
Q: // MichiganCities.cpp - This program prints a message for invalid cities in Michigan. // Input:…
A: I have written the program using C++ PROGRAMMING LANGUAGE OUTPUT : CODE : //…
Q: int index0f (const string& s1, const string& s2)
A: Program: // C++ Version 114#include <iostream>#include <string> using namespace std; //…
Q: Problem 2. (Keygen Program) Write a program called keygen.py that accepts lo (int) and hi (int) as…
A: It is defined as a small program used to generate serials number for software. To use it you should…
Q: 1. Complete read_date(): • Read an input string representing a date in the format yyyy-mm-dd. •…
A: The program is written in Python. Check the program screenshot for the correct indentation. Please…
Q: Problem statement def stringMatch(subStr,strLine): """ This function returns the index…
A: Programming Language: Python def stringMatch(subStr,strLine): if subStr in strLine: #checking…
Q: 2. are_anagrams This function takes two strings and returns True if they are anagrams of one…
A: 1. create two empty strings 2. iterate over the first string 2.1 if the current character is a…
Q: Write a function that takes all even-indexed characters and odd-indexed characters from a string and…
A: In this problem, we need to design the program in the Swift programming language. Logic - for c…
Q: // MichiganCities.cpp - This program prints a message for invalid cities in Michigan. // Input:…
A: You need to check with each and every element in the array of strings and if it equals the input…
Q: 1:- USE "ENCAPSULATION" AND "GETTERS AND SETTERS" WHILE SOLVING THE PROBLEM IF NOT FOLLOWED WILL BE…
A: Coded using C++.
Q: 1 2 def check_character(word, index): # Type your code here. _main__': 3 4 if 5 6 7 _name_…
A: The code is below:
Q: item. This operator can be used anywhere you can use an unsigned integer, including in mathematical…
A: Please find the answer below :
Q: def sparechange(quarters, dimes, nickels, pennies): spareAMT = 25 * quarters + 10 * dimes + 5 *…
A: 1) Below is program to display equivalent dollers for the change quarters, dimes, nickels and…
Q: 9- Evaluate the value of numl, num2 and num3 after execute the following code: int numl = 5,…
A: Lets rewrite Code int num1 = 5,num2 = 3, num3 = 2; num1 = num2++; num2 = --num3;
Q: Telephone directory You have a list of names in the telephone directory. These names are stored in a…
A: PROGRAM EXPLANATION Define a function anagram count to count the anagram strings. Two strings are…
Q: Write a statement that declares a pointer named 'qptr'. The pointer will be used to store the…
A: Write a statement that declares a pointer named aptr'. The pointer will be used to store the address…
Q: Create a function binary_to_ascii_string() that converts binary information into ASCII characters.…
A: The program is written in Python. Check the program screenshot for the correct indentation. Please…
Q: Modify the swap_string function in this task6.c to swap two strings. task6.c Swapping string Only…
A: Above function will not work because function is changing only local pointer variables so changes…
Q: Create a function that takes a string and returns the number of alphanumeric characters that occur…
A: Code: #include <iostream>#include<bits/stdc++.h>using namespace std; int…
Q: Complete the Funnyville High School registration program where user is prompted for her full name…
A: Program to generate emailId and temporary password given a students' full name for funnyville high…
Q: def find_first_occurrence(msg: str, string_to_find: str) -> int: *"Return the index of the first…
A: Note: Answering the question in python as no language is mentioned. Input : Input string as a…
Q: c. Add two polynomials. Prompt the user to enter two polynomials (as above in step a), then add…
A: The code is
Q: In the following declaration: string *var1, var2; O var1 is a pointer to a string, var2 is a string…
A: Pointers must be declared before they can be used, just like a normal variable. A pointer is…
Q: What is the errors here? correct it please //Evaluate the postfix expression //623+-382/+*2&3+…
A: Answer Code in C++ // C++ program to evaluate value of a postfix expression #include…
Q: Assume a given email is valid. Write a program which extracts the username and domain from a valid…
A: C++ PROGRAM: #include<iostream> #include<vector> using namespace std; // main() int…
Q: It wont display the order total // JumpinJava.cpp - This program looks up and prints the names and…
A: #include <iostream>#include <string>using namespace std; int main(){ // Declare…
Q: USING C# Write a console app that inserts 30 random letters into a List. Perform the following…
A: I have mentioned answer in step below, please find in below //C # a programme that generates 30…
Q: Can u debug this Program gets a store's department code and a sale transaction value // Output is a…
A: start declare num dept declare num saleValue declare num NUM_DEPTS = 5 declare num total[NUM_DEPTS]…
Q: KEYWORDS: array, for, nested loops. LAB EXERCISE: Program 1: Write a program for implementation of…
A: Take input array, left, right & x START LOOP – while(left greater than or equal to right) mid =…
Q: Complete the isFloat() function which returns true if a token represents a floating-point number.…
A: The function isFloat() is shown below. bool isFloat(const string& token){ bool flag=false;…
Q: Write a complete Cprogram which must: • Implement the function void swapChars(char" str) which…
A: Store the length of string in n This length can be found by iteration till end of string * will be…
Q: #include #include #include #include #include #include "card.h" #include "deck.h" #include…
A: Actually, program is a executable software that runs on a computer.
Q: int main() int arr[] = {5,2,1,4,6,3}; cout<<lookup(arr,5,3)<<endl; cout<«lookup(arr,1,3)<«endl;…
A: The code is simpe lookup (arr, 5, 3) function called lookup(arr[], int num, int cnt) for loop will…
Q: In Python 3 I have the working code below it just needs 5 functions. NO import pickle! Write a…
A: In Python 3 I have the working code below it just needs 5 functions. Python code :- Dict = {}…
Trending now
This is a popular solution!
Step by step
Solved in 5 steps with 2 images
- I already have the code for the assignment below, but there is some errors in the code. Please help me fix them. The assignment: Make a telephone lookup program. Read a data set of 1,000 names and telephone numbers from a file that contains the numbers in random order. Handle lookups by name and also reverse lookups by phone number. Use a binary search for both lookups. This assignment needs a resource class and a driver class. The resource class and the driver class will be in two separate files. The resource class will contain all of the methods and the driver class only needs to call the methods. The driver class needs to have only 5 lines of code. The code needs to be written in Java. Please help me with exactly what I asked for help. The code: PhoneLookup.java import java.io.FileReader;import java.io.IOException;import java.util.Scanner; public class PhoneLookup{ public static void main(String[] args) throws IOException { Scanner in = new Scanner(System.in);…String spell = "Redikulus"; How would you find the index of the 'u' just before the last 's' using a single line of code? Multiple answers may be correct. Given the string String spell = "Redikulus"; How would you find the index of the 'u' just before the last 's' using a single line of code? Multiple answers may be correct. A. spell.substring(5, spell.length()).indexOf('u'); B. spell.indexOf('u', 5); C. spell.lastIndexOf('u'); D. spell.contains('u'); E. spell.indexOf('u', spell.length() - 2); F. spell.indexOf('u', spell.indexOf('l'));In Python, grades = {'Tim': [87,96,70], 'Sue': [100,87,90], 'Jack': [94,77,90], 'Kevin': [100,81,82], 'Bart': [83, 65, 85]} Ask user to enter the names of the rows, i.e., indices. You can use: len(grades) to get the number of rows of the DataFrame. In addition, using the sort_index() method, ask user whether they wish to sort by rows or by columns and whether to sort in ascending or descending order (do not use any if-else statements) '''
- Please give the correction from this code, where I made the mistakes. The extra two output shown here. How to remove that? #include <stdio.h>#include <stdlib.h>#include <string.h>// movie structurestruct movie {char movieName[1025];int rating;}; int main(void) { // movie structure variablestruct movie list[10];// movie structure pointer variablestruct movie *ptr = list; int ID;// assign std to ptrchar buff; for (int i = 0; i < 8; i++) { printf("Enter number %d movie name: ",i+1); //scanf("%s",&ptr->movieName); gets(ptr->movieName); printf("Enter rating: "); scanf("%d", &ptr->rating); buff = getchar(); // update pointer to point at next element ptr++;} // reset pointer back to the startingptr = list; printf("Enter your ID: ");scanf("%d",&ID); struct movie temp;for (int i = 0; i < 10; i++) { for (int j = 0; j < (9 - i); j++) { if (list[j].rating < list[j + 1].rating) {…this is my code and the question need to be continued. #include <iostream>using namespace std; class Course{private: string name; string *studentList; int size, capacity=10;public: Course(){ name = "TBD"; size = 0; studentList = new string[capacity]; }Course(string s){ name = s; size = 0; studentList = new string[capacity]; }void setName(string s){ name = s; }getter/accessor for variable name string getName(){ return name; }}; int main(){ Course a, b("Yankee"); cout << a.getName() << endl; a.setName("Mets"); cout << a.getName() << endl; cout << b.getName() << endl; return 0;} this is the Question:: Continue with Team class: a) Copy the previous program to a new file.b) Implement the addMember, removeMember and…In Python, grades_dict = {'Wally': [87,96,70], 'Eva': [100,87,90], 'Sam': [94,77,90], 'Katie': [100,81,82], 'Bob': [83, 65, 85]} Ask user to enter the names of the rows, i.e., indices. You can use: len(grades) to get the number of rows of the DataFrame. In addition, using the sort_index() method, ask user whether they wish to sort by rows or by columns and whether to sort in ascending or descending order (do not use any if-else statements)
- Given following code and write comments for those code #include <stdio.h>#include <stdbool.h>#include <string.h>#include <ctype.h> #define MAX_PASSWORD_LENGTH 128#define MIN_PASSWORD_LENGTH 10#define ALLOW_PASSPHRASE true#define MIN_PHRASE_LENGTH 20#define OPTIONAL_TESTS_REQUIRED true#define MIN_OPTIONAL_TESTS_TO_PASS 4 bool isStrongPassword(char *password);void printTestResults(char *password, bool isPassphrase, int optionalTestsPassed); int main() { char passwords[][128] = { "password", "mypassword", "thisismypassword", "passssword", "This is my password phrase1", "Tinypw1", "Ireallydontlikehavingtomakeupnewpasswordsallthetime1", "Iloveyouxxxooo1", "Boom**********!", "IHATEPWORDS1!", "ihatepwords1!", "IHatePwords!", "IHatePwords", "my pass phrase does not need to pass tests", "short pass phrase", "x", "x1", "Zxcvbnmnas7",…do some changes in code and make it unique #include <stdio.h>#include <stdlib.h>#include<string.h>//declaring functionsvoid firstFit(int [], int , int [],int );void bestFit(int [], int , int [],int );void worstFit(int [], int , int [],int );//starting programint main() {//declare partitions and processint partitions [] = {110, 450, 100, 250, 500};int processes [] = {212, 417, 112, 426};//getting their sizesint size_partitions = sizeof(partitions )/sizeof(partitions [0]);int size_processes = sizeof(processes )/sizeof(processes [0]);printf("Partitions size: ") ;for (int i=0; i<size_partitions; i++){printf("%d\t" ,partitions[i] );}//index partprintf("\nPartitions index: " );for (int i=0; i<size_partitions; i++){printf("%d\t" ,(i+1)) ;}printf( "\n" );// calling functionsfirstFit(partitions , size_partitions, processes , size_processes);bestFit(partitions , size_partitions, processes , size_processes);worstFit(partitions , size_partitions, processes ,…modifying following code and write comments for each line of codes. #include <stdio.h>#include <stdlib.h>#include <stdbool.h>#include <string.h> #define MAX_PASSWORD_LENGTH 128#define MIN_PASSWORD_LENGTH 10#define ALLOW_PASSPHRASE true#define MIN_PHRASE_LENGTH 20#define OPTIONAL_TESTS_REQUIRED true#define MIN_OPTIONAL_TESTS_TO_PASS 4 bool isStrongPassword(char *password);void printTestResults(char *password, bool isPassphrase, int optionalTestsPassed); int main() { char passwords[][128] = { "password", "mypassword", "thisismypassword", "passssword", "This is my password phrase1", "Tinypw1", "Ireallydontlikehavingtomakeupnewpasswordsallthetime1", "Iloveyouxxxooo1", "Boom**********!", "IHATEPWORDS1!", "ihatepwords1!", "IHatePwords!", "IHatePwords", "my pass phrase does not need to pass tests", "short pass phrase", "x", "x1",…
- a) Write a c++ program which contains a function isPalindrome, the function checks a stringusing pointers whether it is a palindrome or not and based on the decision return Ture orFalse. A string/word that reads the same backwards as forward is known as palindrome.E-g MADAM , POP , BOB etcb) Write a program that takes a char array (char *) that take your name as input, a charpointer point it and convert lower to upper and vice versa.What is printed to the console when the code that follows is executed? ArrayList<String> passwords = new ArrayList<>(); passwords.add("akjdk12"); passwords.add("buujl32"); passwords.add("chrcl92"); passwords.add("nnnii87"); passwords.set(2, "cb2kr45"); passwords.remove("akjdk12"); System.out.println(passwords.get(1));using this c++ code add these improvements -want to ignore whitespace -allow number #include <stdio.h> #include <ctype.h> #include <stdlib.h> int lookahead; void expr(void); void rest(void); void term(void); void match(int); void error(void); int main(void) { lookahead = getchar(); expr(); putchar('\n'); /* adds trailing newline character */ } void term(void) { if (isdigit(lookahead)) { putchar(lookahead); match(lookahead); } else error(); } void match(int t) { if (lookahead == t) lookahead = getchar(); else error(); } void error(void) { printf("syntax error\n"); /* print error message */ exit(1); /* then halt */ } void expr(void) { term(); while ( 1) { if (lookahead == '+') { match('+'); term(); putchar('+'); } else if (lookahead == ' - ') { match(' - '); term(); putchar(' - '); } else break; } }