in c with comments
Q: Using script file in MATLAB/OCTAVE,
A: Code C) x = -2:0.5:2; y = exp(x); f=log(x) plot(x,y,x,f)
Q: uniq.c Write a program that rea It should read lines from a count of how many tim and "Hello" not…
A: Given:- Write a program that reads from stdin and filters out duplicate lines of input. It should…
Q: Sir help me I am trying to print something in c but I getting error printf is not defined. I…
A: Here in this question we have asked about error in c language while printing something..
Q: 1. Design and Implement a single linked list with the following operations, lectures single linked…
A: We provide first question answer only because company norms and guidelines.
Q: Write a function definition for a function name Accept a string as an input parameter. Return the…
A: We are asked , to write a function definition for a function named getLast () : Given that:- a)…
Q: Do in C++ Print pascal triangle.
A: Print spaces and then print coefficients
Q: Write a program that: 1. Reads in a number: numStar 2. Prints a row of (*) that is numStar long,…
A: C code for above : #include<stdio.h> int main(){ //declarations int numStar;…
Q: In this task, you will write a function int toInt (char* Roman) that takes in a character array that…
A: c is a programming language. it is mainly associated with UNIX. C was first design to write unix…
Q: Cafe Customer name: john Customer Table number: 8 Please enter order [1]: maggie Please enter…
A: C Program for above : #include <stdio.h> int main() { char name[20], order[3][20];…
Q: write Program c++ to check equilateral, scalene or isosceles triangle Note: A triangle is said…
A: Declare the required libraries. Declare the main function. Declare the variables of appropriate data…
Q: (a) Based on the following program segment, state what is wrong for finding the smallest input…
A: Here in the solution comments (//comment) has been used to tell in which line the error will occur.…
Q: chicke the error C++
A: Assumption : Option is made correct if option contains error option 1 is correct since ptrObj1 is…
Q: The main control constructs in C to loop through blocks of code are the “for" loop, the “while" loop…
A: In while loop, a condition is evaluated before processing a body of the loop.
Q: i need to tranform from C to C++
A: Given Code in C is: After replacing the printf with cout and scanf with cin statements the c++…
Q: Question 3 The string data type is an inbuilt data type in c++ O False O True
A: Defined the given statement as true or false
Q: Please help with the follow question in C++
A: A Queue is constructed as follows,/*Define the method that places an item into the Queueand returns…
Q: 11 12 14 14 15 200 30 300 100 20 45 45 30 20 20 3. Traverse the array to search for the largest and…
A: Note - As per our guidelines, we can provide solution only for one question. But, as the questions…
Q: ?If possibly to do it in C please or C++
A: Step-1) First, declaring the variables according to the requirements.Step-2) Then, print Weekly…
Q: Question # 1: Write a C++ code to display the middle value of S Linked List (null terminated). 1-2→…
A: CODE: To find middle of single linked list #include<iostream>#include<stdlib.h>using…
Q: Please help with the follow question in C++
A: Program Instructions:Create a function insertOnTheTop() that makes a new node and assign that node…
Q: Write a function that takes in two numbers n and s. The function should verify that n divides…
A: The answer is given below. Algorithm: Start. Prompt the user to input the values n and s. If n is…
Q: Write a program that: 1. Reads in a number: numStar 2. Prints a row of (*) that is numStar long,…
A: In while loop you can iterate for numStar times
Q: 4. Create a function in the C language that takes an integer as the parameter and returns the count…
A: Create a function in the C language that takes an integer as the parameter and returns the count of…
Q: Can translate this to C++
A: Given there are two images in the question, python code from line 51 to line 88. I have converted…
Q: rotate function in C language
A: Program: #include <stdio.h>#include <stdlib.h>// declaration of row and columns in…
Q: b) Substitution Perform a polyalphabetic substitution using the Vigenère cipher on the input file…
A: One way to encrypt the alphabetic text is with the Vigenere Cipher. Polyalphabetic substitution is…
Q: i. Define a two-dimensional, 3 x 3 integer array called M. ii. Assign the values 1, 3, 5, 7, 9, 11,…
A: Code: #include<stdio.h>int main() { int M[3][3]; int k=1; float sum=0,count=0;…
Q: 1. Write a very simple program that: 1. Has a main function (all C executables have one). 2. Has two…
A: Due to bartleby guidelines i can only answer one question.please repost other parts as a separate…
Q: Write a program that process 10 assessment marks of student. Input the marks and process the data to…
A: The program is written in C Language. Please find the program code and comments in step 2.
Q: Problem Given a list of newline-separated park sections and an animal pattern (as a letter…
A: Your C program is given below as you required with an output.
Q: In C why doesn’t the string print without \n?
A: C language: the "C" programming language was created by Dennis Ritchie. It is a general-purpose…
Q: 2) Suppose that an intermixed sequence of push and pop operations are performed. The push operations…
A: Give options - (a) 4321098765 (b) 4687532901 (c) 2567489310 (d) 4321056789
Q: What is the programming error in the following C segmentation code: Total a + b + c; Average Total /…
A: Computer programming is the process of designing and building an executable computer program to…
Q: 3. The number of ways of arranging r objects chosen from n, where order is important (these are…
A: In this question we need to implement a C program which takes value of r and n as input from user…
Q: Task 5: Unscramble You will write a program that takes in 2 files: a dictionary file and a file…
A: Here is a sample C program that takes in two files: a dictionary file and a file listing jumbled…
Q: To write a C++ function which accepts your name (string) as an input and print it in reverse order…
A: I have given an answer in step 2.
in c with comments
Step by step
Solved in 2 steps
- Write a program that reads a stream of integers from a file and writes only the positive numbers to a second file. The user should be prompted to enter the names of both the input file and output file in main(), and then main() should attempt to open both files (providing an error if there is an error during this process). The main() method should then call the process() method to read all the integers from the input file and write only the positive integers to the output file. The process() method takes as arguments a Scanner to read from the input and a PrintWriter to write to the output. You can assume that if you are able to successfully open the input file, then there will only be integers in it.A file words.txt contains a large number of English Language words, one per record. Write a program that uses this file to implement a simple word checker. First, read all the words into a collection. Then, using this collection find the average length of all the words and write this number to the console.Finally, using a text file that contains written English paragraphs, the program should examine each word of each line and output to the console all the words that are not in the collection as potentially misspelled words. Write to the console how many words in this text file are above the average length of the dictionary words computed above.Write a program to copy an existing text file from your hard disk to another file that you will call: Your Last Name.txt, e.g. if your last name was Smith, the output file name would be Smith.txt. You can create a text file and add two or three lines of text to it. You may use the attached program as your program or write your own. Please note the inclusion of <fstream> at the top of the program. Also pay attention to the open and close statements in the program. // LAB6.cpp// Kunika Saxena// File: CopyFile.cpp// Copies file InData.txt to file OutData.txt #include <cstdlib> // for the definition of EXIT_FAILURE#include <fstream> // required for external file streams#include <iostream>using namespace std; // Associate stream objects with external file names#define inFile "InData.txt"#define outFile "Saxena.txt" // Functions used ...// Copies one line of textint copyLine(ifstream&, ofstream&); int main(){ // Local data ... int…
- Write a program that reads two input files whose lines are ordered by a key data field. Your program should merge these two files, writing an output file that contains all lines from both files ordered by the same key field. As an example, if two input files contain student names and grades for a particular class ordered by name (the key field), merge the information as shown below. File 1 and file 2 are supplied. Here is an algorithm to merge the data from two files: Read a line from each data file While the end of both files has not been reached While the end of both files has not been reached Write the line from file 1 to the output file and read a new line from file 1. Else Write the line from file 2 to the output file and read a new line from file 2. Write the remaining lines (if any) from file 1 to the output file. Write the remaining lines (if any) from file 2 to the output file. See the Merging Filesslides attachedto the project in Canvasfor a visual look at this algorithm.Write a program that edits a text file to display each complete sentence with a period at the end in a separate line. Your program should work as follows: Ask the user to input file name containing sentences separated with a period (sentences may be in single line as a paragraph contains multiple sentences). Create a temporary file, copy from the source file to a temporary file and perform the required operation (write all sentences at a different line without a period). Copy the contents of the temporary file back into the source file. Use a method (or methods) in the class File to remove the temporary file. You will also want to use the class File for other things in your program. The temporary file should have a name that is different from all existing files so that the existing files are not affected (except for the file being edited). Your program will ask the user for the name of the file to be edited. However, it will not ask the user for the name of the temporary file but will…Write a program that prompts the user for an input file name, reads all words from the input file, and writes the words to the output file sentences.txt. Start a new line whenever a word ends in a period, question mark, or exclamation mark. Also do this if the period, question mark, or exclamation mark is followed by a quotation mark. Otherwise, separate words with spaces. main.cpp in1.txt in2.txt 1 #include 2 #include 3 #include 4 using namespace std; 5 6 int main() 7 { 8 9 10 11 12 13 14 15 } string input file_name; cout > input file_name; /* Your code goes here */ return 0; << endl;
- Write a program that removes all the occurrences of a specifiedstring from a text file. For example, invokingjava Exercise12_11 John filenameremoves the string John from the specified file. Your program should get thearguments from the command line.write a program that will open a file called “story.txt”and count the number of occurrences of each letter from the alphabet in this file.At the end your program will output the following report:Number of occurrences for the alphabets:a was used – times.b was used – times.c was used – times…. …and so, onAssume the file contains only lower-case letters and for simplicity just a singleparagraph. Your program should keep a counter associated with each letter of thealphabet (26 counters) [Hint: Use array]Your program should also print a histogram of characters count by addinga new function print Histogram (int counters []). This function receives thecounters from the previous task and instead of printing the number of times eachcharacter was used, prints a histogram of the counters. An example histogram forthree letters is shown below) [Hint: Use the extended asci character 254]:Write a program that gets 2 or more command-line arguments. The last argument is a file that the program will send its output to. The other arguments are names of input files that already exist and that contain integers. The program opens each of the existing input files, in the order given by the arguments, and reads and sums all the integers of each file, writing the name of the Input file followed by its sum to the output file (given by the last argument). EXAMPLE: If the program were invoked like this: a.out fileA fileB filezzz and if the content of fileA was "398" and that of fileB "4 1" then the output written to filezzz would be: fileA 20 fileb 5 1 of 1 Sun Mar 13 2022 1141:38 GMT-0400 (EDT) SUBMIT RESET import ays A out- open (sys.argv(-1), w) Here you are accessing the out put tile
- Write a program that prompts the user for an input file name, reads all words from the input file, and writes the words to the output file sentences.txt. Start a new line whenever a word ends in a period, question mark, or exclamation mark. Also do this if the period, question mark, or exclamation mark is followed by a quotation mark. Otherwise, separate words with spaces. Complete the following file: sentences.cpp 1 #include #include 3 #include 4 using namespace std; 6. int main() 7 { cout > input_file_name; 8 « endl; 9. 10 11 12 13 14 return 0; 15 } SubmitWrite a program that uses File I/O (input and output files). This is a Java program.Write a program that will read the file text.txt which is provided and the encryptedmessage in there. Please write back the decrypted message into the output.txt file.When you see the message in the output.txt file, you need to submit the java codefile. You need to use Rot13 class for decrypting the message. Do not need to submit in the output.txt file. file example: public class FileExample { public static void main(String[]args){ try {//create file object for input.txtFile in_file = new File("src/input.txt");//create file object for output.txtFile out_file = new File("src/output.txt"); //read the input.txt file with ScannerScanner read = new Scanner(in_file);//write the output.txt file with PrintWriterPrintWriter w = new PrintWriter(out_file); while(read.hasNextLine()){w.write(read.nextLine());} //don't forget to closew.close(); // while(scan.hasNext()){// System.out.println(scan.next());// } }catch(Exception ex){ex.getStackTrace();}