1. Write a program that reads two strings from the keyboard using a while loop A.Terminate the loop when both strings have the same content, done B.Display both strings if the contents are different C.For strings with the same contents, display if they are at the same address
Q: m reads one text file: – input.txt • Your program creates a text file: – output.txt • Your program…
A: It is defined as a kind of data structure that can store a fixed-size sequential collection of…
Q: Write a function encrypt that receives a message with a string or character vector and returns the…
A: If the given string is encrypted, the first letters of all words will be This is the first question…
Q: This question concerns the use of a book cypher to encode a message. Write a program called…
A: A Python program is as follows, File name: “bookcypher.py” def main(): #Get input file name…
Q: You initially start with a binary string S0 which is of length N and has all 0s. You are then given…
A: I have given an code and output in step 2.
Q: Write a program in C/C++ that takes a password of ‘n’ length from the standard input terminal and…
A: Here, we have to write the program to find the length of the password entered by the user.
Q: USING PYTHON: Given a list of 10 names, complete the program that outputs the name specified by the…
A: PROGRAM CODE: names = ['Ryley', 'Edan', 'Reagan', 'Henry', 'Caius', 'Jane', 'Guto', 'Sonya',…
Q: Write a functional program that sorts 10 input integers (signed) using either bubble sort or…
A: The below given C++ program will obey the following rubrics: Including necessary header file,…
Q: Write a C++ program that searches for "anagrams'' in a dictionary. An anagram is a word obtained by…
A: Coded using C++.
Q: Write a C program Assume that numbers.txt is a textfile with non-negative integers, with one per…
A: The program is written in C #include <stdio.h> int main(void) { FILE *fptr; int…
Q: CSE Python LAB: Question 2} You initially start with a binary string S0 which is of length N and…
A: Refer to step 2 for the answer.
Q: 13. The reciprocal Fibonacci constant y is defined by the infinite sum: ν- ΣΕ where F, are the…
A: Program:n = [10 50 100];for j = 1:3a = 1;b = 1;reci = 1/a+1/b;for i = 1:n(j) - 2c = a + b;reci =…
Q: 10. Given a list of unsorted integers, find the pair of elements that have the smallest absolute…
A: Coded using Python 3.
Q: You initially start with a binary string S0 which is of length N and has all 0s. You are then given…
A: Python has inbuilt functions to sort (sort() and sorted()) and can append to a list using append()
Q: Implement the following programs in cpp code; Write a program to convert all the characters in…
A: note: we are only allowed to solve one question in one post. please post other questions in a…
Q: Write a function decode_string() that gets a string as a parameter -so called encrypted string-,…
A: Input : String from user The dictionary of codes Output : Decoded string
Q: write a program to check that array is empty or not and write its algorithm in c++?
A: Given To do a c++ program to check that array is empty or not.
Q: Complete the following program with two lines such that the data from the URL is retrieved into a…
A: we have to write the code
Q: 10. Consider the following program, implementing binary search to look for a word in a list of…
A: Binary search algorithm: Repeatedly divide the search interval in half. Begin with the whole…
Q: Consider a CSV file contains information about COVID-19 status of Bangladesh. The header of this…
A: Solution- Programming Language - Java All necessary comments are included in program code. Store…
Q: can you please solve the question and make it in the right format so that I can copy and paste it?…
A: In this question, first, we accept the no of words that users want to enter, and after that string.…
Q: Exercise 20 the string below comes from an alphabet consisting of only characters A and B.…
A: I have provided c++ code in step2.
Q: . What is the output of the following code (assume all libraries are included): Answer: a) True b)…
A: Here we have given multiple question. In first question we need to find the output of the given…
Q: Write a C++ program that takes an char array of size twenty. Take input a sorted array from the…
A: Sample Response: //C++ programming language#include <iostream> using namespace std;//main…
Q: C PROGRAM lets say i have a txt file and in the file there is a text like this : The Catcher in…
A: #include <stdio.h> #include<ctype.h>#define MAX_FILE_NAME 100 int main() {…
Q: 4. Suppose, you are trying to encrypt a string for security purpose. Write a program that can take a…
A: Step 1 : Start Step 2 : Create a function str_modify which takes a character array (string) to…
Q: Write a C program that reads a number of X integer numbers from an input file (where Xis always less…
A: first let's see what is c language? C is a procedural programming language that allows for…
Q: C++ program that reads first name and last name from two txt files,
A: Program: #include <stdio.h>#include <stdlib.h>#include <iostream>using namespace…
Q: print the output
A: Out put of the following code is : main.asm:6: error: comma expected after operand 1 main.asm:10:…
Q: 2. Suppose that you are implementing a program to write a string "CSE SS0" in a binary file. Java…
A: In java, there are some methods that are used for write a number, a boolean value, a character or a…
Q: In Java languge (Duplicate Elimination) Write a program that reads in a series of first names and…
A: Java program to solve the given problem is below.
Q: code
A: According to the question we need to do some changes to the code and make it unique. The Given Code…
Q: Write a program in C++ that can perform encryption and decryption using an arbitrary substitution…
A: A program in C++ that can perform encryption and decryption using an arbitrary substitution cipher.…
Q: 1) Read the data stored in the file "rec.txt" into an array of records containing the student ids…
A: The C program of this following problem is implemented below:
Q: Using C++, Write a program (without using void) to produce the first 100 Fibonacci numbers.
A: Before starting with the program I would suggest a correction. A Fibonacci number is the sum (not…
Q: Write a complete C++ program which can multiply three matrices. O D D Example A=D D O D D O B = D O…
A: In this code, two 3x3 matrices are input by the user and the matrices are multiplied and hence the…
Q: Q1) Write a C program that gives the following output with using nested loop: X 1 1 0 X 1 0 0 X
A: note:- We are not allowed to answer more than one programming. Logic:- In a nested loop when…
Q: What is the complexity of the following code segment (assume all the libraries are included)? int x…
A: The correct option is
Q: c++ programming language Please help me with this program. The task and numbers.txt is attached…
A: The program will take input from user in file.txt file. Then we will calculate the number of…
Q: } You initially start with a binary string S0 which is of length N and has all 0s. You are then…
A: I have given an answer in step 2.
Q: Using Java, write a simple Insertion Sort program that can read in integers from a text file (line…
A: //Java Source Code :- import java.io.BufferedReader; import java.io.BufferedWriter; import…
Q: Write a C++ Program that reads a file named "Paragraph.txt" as input to the Program. Your task is to…
A: The code is given in step 2.
Q: 2. Write a program that will initially create a SORTED list containing the following and then run…
A: The answer is given below:-
Q: Write a c language program to scan a character array n and an integer k from the user, then…
A: code: #include<stdio.h> int main() { char arr[] = {'a','b','c'}; //Initialize array int…
Q: Python Scrabble is a word game in which words are constructed from letter tiles, each letter tile…
A: Program Approach: Create a dictionary to store letters with their values. Find each letter value of…
Q: 13. The reciprocal Fibonacci constant y is defined by the infinite sum: Σ. where F, are the…
A: Hey, since there are multiple questions posted, we will answer first question. If you want any…
Q: Write a program that replaces words in a sentence. The input begins with word replacement pairs…
A: Program code: #Define main() function def main(): #Read data from the user replace_pairs =…
Q: Write code for below problem. The input below is just an example and you should implement…
A: Given: You will have an orthogonal triangle input from a file and you need to find the maximum sum…
Q: Write a version of the sequential search algorithm that can be used to search a sorted list. Write a…
A: Given :- Write a version of the sequential search algorithm that can be used to search a sorted…
1. Write a program that reads two strings from the keyboard using a while loop
A.Terminate the loop when both strings have the same content, done
B.Display both strings if the contents are different
C.For strings with the same contents, display if they are at the same address
2.Demonstrate a situation in which the JVM will use garbage collection
3.Given the following strings:
Middlesex CollegeDemonstrate the use of the following String methodsconcat(), length(), trim(), charAt(), both substring()
Step by step
Solved in 3 steps with 1 images
- Trace the following Code and then print the output. msg db 'hello world$' newline db 10,13,'$' buffer db 10 dup mov ah,9 mov dx,offset msg int 21h ;new line mov ah,9 mov dx, offset newline int 21h ;enter a string from the keyboard lea dx,buffer mov ah,0ah int 21h ;new line mov ah,9 mov dx,offset newline int 21h ;adding the $ symbol at the end of the string mov bx,0 mov bl,buffer[1] mov buffer[bx+2],'$' mov ah,9 mov dx,offset buffer+2 int 21hWrite a C++ program that searches for "anagrams'' in a dictionary. An anagram is a word obtained by scrambling the letters of some string. For example, the word "pot'' is an anagram of the string "otp." For this solution you must not use recursion. Instead, use the std::next_permutation function in the algorithm library. Here is a downloadable link to the words.txt file, but you must be logged in to a google account for it to show up: https://drive.google.com/file/d/1GSIp0R224wnJUARW1qj1AnBWKO-cZyS8/view?usp=sharingHere is a sample of how the program might work:Please enter a string for an anagram: optMatching word optMatching word potMatching word top Here is another sample of how the program might work:Please enter a string for an anagram: blahNo matches foundYou must write these two functions with the exact same function signature (include case):int loadDictionary(istream &dictfile, vector<string>& dict);Places each string in dictfile into the vector dict. Returns the…Computer Science For each of the code snippet given below, identify the error and then write code after fixing the error. Given code is the simulation of grep -v command. -v prints all lines that do not match a specific pattern. void grep_inverse(char *filename, char *str) { FILE *fp; char buf[buff_size]; fp = fopen(filename, "r"); if(!fp) { perror(filename); } else { while (fgets(buf, buff_size, fp) != NULL) { if ((strstr (buf, str)) != NULL) printf("%s", buf); } } fclose(fp); }
- please use python Write a program that first reads in the name of an input file, followed by two strings representing the lower and upper bounds of a search range. The file should be read using the file.readlines() method. The input file contains a list of alphabetical, ten-letter strings, each on a separate line. Your program should output all strings from the list that are within that range (inclusive of the bounds). Ex: If the input is: input1.txt ammoniated millennium and the contents of input1.txt are: aspiration classified federation graduation millennium philosophy quadratics transcript wilderness zoologists8.27 LAB: Scrabble points Scrabble is a word game in which words are constructed from letter tiles, each letter tile containing a point value. The value of a word is the sum of each tile's points added to any points provided by the word's placement on the game board. Write a program using the given dictionary of letters and point values that takes a word as input and outputs the base total value of the word (before being put onto a board). Ex: If the input is: PYTHON the output is: 14 python tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, 'S': 1, 'T': 1, 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 }Write a C# program that asks the user to enter a sentence, and then counts the number of words in the sentence. Your program should do the following: Ask the user to enter a sentence using the Console.ReadLine() method. Use the Split() method to split the sentence into words based on spaces. for example: // Split the sentence into words based on spaces string[] words = sentence.Split(' '); Count the number of words in the sentence using the Length property of the resulting array. Print a message to the console indicating the number of words in the sentence using the Console.WriteLine() method. Provide the code for your program (the .cs file). Example output: Enter a sentence: The quick brown fox jumps over the lazy dog. The sentence contains 9 words.
- 8.In this exercise you will create a program that will be used in a digital library to format and sort journal entries based on the authors last name. Each entry has room to store only the last name of the author. Begin by removing the first name "Isaac" from the string variable journal_entry_1 by using the string function erase. Do not forget to also remove the whitespace so that the string variable journal_entry_1 will then contain the string "Newton" with no whitespaces. The journal entries should be sorted alphabetically based on the authors last name. For example, the last name "Brown" should come before the last name "Davis" Create an if statement so that if the last name contained within journal_entry_2 is alphabetically less than the last name contained within journal_entry_1, then the string values are swapped using the string function swap. You may use either of the comparison operators < > in the if statement but remember that following ASCII, "A" is lexicographically…Can you fix the output of the Gantt chart in the code and the output of the gantt chart should be the same in the image below? The instruction also on how to solve the Gantt chart is in the image below. Badly need to fix it :( Thank you! Code: #include <iostream>#include <queue>#include <string>#include <vector> struct Process { int processId; int burstTime; int priority;}; void print_gantt_chart(const std::vector<std::pair<int, int>>& gantt_chart) { std::cout << "Gantt Chart:" << std::endl; std::cout << "----------------------------------------------------------------------------" << std::endl; std::cout << "| "; for (const auto& process : gantt_chart) { std::cout << "P" << process.first << " | "; } std::cout << std::endl; std::cout << "----------------------------------------------------------------------------" << std::endl;…Write a program to read several lines from a file. For each line, check (recursively) whether it is a palindrome. If it is a palindrome output the original string preceded by an integer (a counter) , like this: 1 : Sore was I, ere I saw Eros.2 : A man, a plan, a canal -- Panama Recall that a palindrome is a String that is the same backwards and forwards. Some examples of single words that are palindromes are: level, madam, racecar Phrases can also be palindromes if you strip out all the whitespace and punctuation and make everything the same case. Some examples are: Madam, I'm Adam A Toyota's a Toyota (See the palindrome video for more) You will need one method to eliminate whitespace and punctuation , make everything lowercase, and return the new string. Use the recursive method you wrote in L15Num2. This returns a string with no whitespace or punctuation, but not all the same case. Then (in main) convert that string to lowercase. You need a recursive method that takes the new…
- C1- a- Write a Python program to input user’s name and how many people are in the dinner party tonight. If the number of people is more than 8, print a message that they have to wait, otherwise print that table is ready. In both situations the message must mention the user name as follows: I’m sorry, Sameh has to wait for a table. OR Sameh’s table is ready b- Remove all instances of “dog” from the list where pets = ['dog', 'cat', 'dog', 'goldfish', 'cat', 'rabbit', 'cat']. Display the list before and after removing.Please do this in PYTHON PROGRAMMING Write an address book program that stores your contacts' names and their email addresses. The names and email addresses are originally stored in a file called phonebook.in, in the format:Harry P..d@hogwarts.eduHermione G..h@hogwarts.eduRon W..b@hogwarts.eduDraco M..s@hogwarts.eduSeverus S..e@hogwarts.eduAlbus D..x@hogwarts.eduYour program should read from the file, storing the names and corresponding email addresses in a dictionary as key-value pairs. Then, the program should display a menu that lets the user enter the numbers 1 through 5, each corresponding to a different menu item:1) look up an email address2) add a new name and email address3) change an email address4) delete a name and email address5) save address book and exitWhen the user enters 1, the program should prompt them for a name, and then print the corresponding email address. If there is no dictionary entry under that name, the program should print, "Sorry, no contact exists…A Canadian postal code is a six-character alphanumeric string that represents a part of a postal address. They are in the format of A1A 1A1, where A could be any letter and 1 could be any number from 0-9. Given an unsorted list of postal codes, write a Python program, in a file call postal.py, to sort the list of postal codes (actually modify the given list into a sorted list) and then display the sorted postal codes such that each postal code with the same starting letter is printed on the same line, with each line in alphabetical order. Note that the postal codes can be in any order on the same line, as long as they all start with the same letter, or you can have them sorted on the line as well. For example, given the following list of postal codes: postal_codes = ['A1A 1A1', 'B3K 5X5', 'V9A 7N2', 'A0Z 6P7', 'H0H 0H0', 'A1B 1T0'] The output would be similar to: Sorted postal codes: A0Z 6P7 A1A 1A1 A1B 1T0 B3K 5X5 H0H 0H0 V9A 7N2 Note: You are not permitted to use the sort() method.