instruction
stringlengths
71
95.1k
I am trying to build a personal content aggregator and I started off with Reddit. My aim is to build something that is designed properly for this task so that I could add more sources and delivery options easily. If possible, I'd like you to focus your reviews on the design of the code (any other feedback is welcome as...
first time posting here, as well as being new to coding in Java. I am trying to create a movie queue with an array that is able to contain 100 elements, but will only read and print the elements the user enters. I got the first section where a user enters a movie and it stores it and prints it working properly, I am ju...
Goal My program takes a yaml config file as parameter python myprogram.py cfg.yml. all modules can access the cfg content with a simple module import the imported config behaves like the loaded top-level yaml dictionary for reading operations # module_a.py from config_module import cfg_class as config print(config['p...
The problem is as below: Two archery teams A and B compete with the same number of members. If the score of team A[i] is higher than that of team B[i], the total score of team A will be +1, so given team A and B with any number of members, please calculate how total score of team A will be the highest value and write ...
I have a Spring MVC controller but I'm not sure that it is a good or bad design. As far as I know, api versioning is missing but apart from that I implemented Swagger for documentation and added SpringSecurity and tried to follow YARAS(Yet Another RESTful API Standard) to build it but I need another eye on that to comm...
I have made a program that does what the title explains. It also hashes the file to check for changes. I will be doing this for a project to keep track of files that has been changed when doing different things in that certain filetree. I need this to be done as an sqlite/python app to make information easily available...
This code compares data from two spreadsheets generated from our clinic's software. The goal is to eliminate all the rows from the PaymentsSheet (our most recent transactions) that are duplicated on the InvoicesSheet (already uploaded transactions) to avoid duplicating info when we upload it to our account software, ma...
For my project I have a sorted array of objects of timestamps (in milliseconds) and I need two functions. One function should find the closest time that doesn't go over a specific amount, and the other function should find the closest time that doesn't go under a specific amount. Also, they should return the indices of...
I've been trying this question from SPOJ, which asks for the user to enter a number n, and they will receive a maximum fusc value that lies in between 0 to n. The conditions for the function are: F(0) and F(1) is 0 and 1 respectively For any even number, the value is F(n) = F(n/2) For any odd number, the value is F(n)...
I wanted to have a factory-method, but without the if statements that are often seen in examples of this pattern. So I came up with this, and would like to know: is this a right approach, should there be any impovements? some things I considered: It is using Enum because that makes it possible to iterate or list the p...
My game is a grid in which you have to change cells color by clicking on them. When I generate a grid I have to know all the possible combinations of blue and white cells my game allows, to know the difficulty level of the grid. Each time I create a scenario I have to update an important parameter which is groups of wh...
I am currently trying to better my understanding of python and good coding practices and would really like some input on a question i have been thinking over for weeks now. I am currently working on building a virtual microprocessor out of basic logic gates (And, Or,...). The idea is to assemble more and more complex c...
Task description A binary gap within a positive integer N is any maximal sequence of consecutive zeros that is surrounded by ones at both ends in the binary representation of N. For example, number 9 has binary representation 1001 and contains a binary gap of length 2. The number 529 has binary representation 10000100...
I was busy writing an answer for this question when I realized that I was busy creating a new solution without explaining what the original poster did wrong, again. So I decided to rather post what I came up with as a new question. Please feel free to rip it apart or see if you can beat my pathetic high score =) using...
I have been obtaining financial information on an annuity I have which is invested in multiple funds which are proprietary to the insurance company. The asset value is not available other than on their website. I have been obtaining the information using VBA and Internet Explorer. Due to the rumor that IE will be disc...
Recently, I wrote a class which can load an .obj file into vector array, and save the vector array as an .obj file. The .obj file looks something like this: v 0.041159 -0.342570 1.029412 //vertices position : x, y,z v 0.015579 -0.341674 1.077751 v 0.014664 -0.341184 1.031222 v 0.041923 -0.343100 1.073583 v 0.064655 -0....
Last night I was practicing incrementing strings. What it needs to do is increment the last character if it is a digit or letter. Special characters are ignored. The code that I have written does the job but I have a feeling it can be accomplished in a more elegant way. Or a faster way. Can somebody suggest faster, eas...
Hello everyone. I wrote my own test module, which is responsible for measuring the timing of algorithms, I used it mainly for sorting algorithms this is so to say a very early beta version, which I would like to expand with various functionalities, in general I would like to take care of the appearance of the code. I l...
My mission is to solve this: Write a function that will take an array of numbers, and will return the average of all numbers in the array that are prime number. So far I wrote this: function average(a){ var arr=[]; var newarr=[]; var i,j,sum,sum1,average,counter,counter1; counter=counter1=sum=sum1=0; for...
I need to estimate risk differences for marginal models. I have worked on the Probratio function to create an equivalent function for RDs that works. Please provide feedback on accuracy or comments to improve efficiency where necessary. probdiff <- function(object, parm, subset, method=c('ML', 'delta', 'bootstrap'), s...
Abstract The bash shell utility mkdir is a tool used to create directories in most POSIX environments. I thought it would be fun to implement such functionality from C++ and maybe forge in some of my own features in the future. I will be using the C++ library Boost to handle the command line options and the Standard Te...
I wrote a small program that connects to a minecraft rcon and provides an easy to use control panel. It is written in python 3.9 and uses the kivy module for the GUI. What could I improve in the code? Are the variable names easy to understand and if not, how could I improve them? Here is the main.py and the pmcp.kv: ma...
Here is an implementation of binary search. Please give feedback on any part but a few specific areas I was wondering about. Is size_t used appropriately or should int or unsigned int be used instead? How can I shorten selfTest() and in general make it better? I know it's clunky how it returns a value and prints an er...
I did the following Created DB and table in prepate_table function Extracted data from binance in GetHistoricalData function Saved the data to DB My code works fine but I want to optimize my code and remove redundant steps My solution import os import pandas as pd import time import clickhouse_driver import datetime ...
I have written a function that randomly picks one element from a set with different probabilities for each element, anyway it takes a dictionary as argument, the keys of the dictionary are the choices and can be of any type, the values of the dictionary are weights and must be non-zero integers. It randomly chooses a c...
I need to convert objects (potentially nested) and collections (int[], IEnumerables, object[]) into a query string that I can pass to a GET HTTP call. I didn't find any complete answer on SO so I had to merge some answers and add something to make them all work together. This is the current version that works with all ...
I have this code to remove duplicates (all occurrences) from an associative array, does PHP have methods to do this ? Or is there a way to improve the code ? I looked for array_unique, array_search, array_map, array_reduce... $articles = [ [ "id" => 0, "title" => "lorem", "reference" => "A" ...
There are many debouncer and throttle implementations created using Grand Central Dispatch, and even one built into Combine. I wanted to create one using the new Swift Concurrency feature in Swift 5.5+. Below is what I put together with help from others: actor Limiter { enum Policy { case throttle c...
This program converts from number system A to number system B as soon as you input something in it, as a rookie it took a lot of thinking to make it work a seamless and fool-proof way. It converts the number from base A to base 10 and then to base B because the formulas are always the same. It is based on this website...
Below is my code: private double GetImageValue(Bitmap Image) { double ImageValue = 0; for (int X = 0; X < Image.Width; X++) { for (int Y = 0; Y < Image.Height; Y++) { Color CurrentPixel = Image.GetPixel(X, Y); ImageValue += CurrentPixel.A + CurrentPixel.B + CurrentP...
For a hobby project I want to visualize the current crypto market in bubbles. The idea is to clone cryptobubbles.net. I've already made a prototype at the moment, but the frames are on the low side. How can I optimize my code to get more frames? The application is made in JavaScript with react and d3 import React, { Co...
I'm at an intermediate-ish level in java programming in school (using repl.it), and I have a math related project I'm working on. After the user inputs their own measurements, "calculating......." is outputted into the console and the periods are "animated" so to say. The code works fine but I'm convinced there has to ...
I am creating a .NET Framework MVC EF application for PC components. I wanted to make full use of inheritance, polymorphism and generic repository pattern - but was wondering if my initial design implementation is the best way to go about it. The major sections of the codebase are below: Repository I wrote this intend...
As you might probably know, a Caesar cipher involves shifting/unshifting and wrapping up characters when they overflow the first or last letter of the alphabet, it's useful to have a function to just handle character shifting. So I wrote a function that I intend to use in other places and was hoping to see if there are...
I needed the ability to truncate the trailing end of path strings in a routine that builds new search paths as it recursively searches directories. After not finding what I was looking for I created function below. Expected behavior is that function remove_trailing_chars() will update in to remove any occurrences of ch...
I'm creating a program that finds the roots of Bhaskara’s formula and prints them. I'm looking for advice to improve my logic more and more. #include <stdio.h> #include <math.h> int main () { double os; double four; int a; int b; int c; int robf; double x1; ...
I'm trying to move a large number of files. I get the path of source and destination from database. It takes hours to move images, and I was wondering if there is a faster way for moving large numbers of files. Table example: source destination C:\x D:\y C:\z D:\y This the code I'm using. var datasource ...
I have completed my project which models the paths of particles in a plasma experiencing a force. The program creates phase diagrams of a particle's perpendicular velocity against its parallel velocity from 0 to 180 degrees. I would like your thoughts and improvements on my implementation. Here is the code: import matp...
For a college assignment, I was tasked with the following (excerpt from provided code file): Find one string of characters that is not present in the list. You are provided a function that loads the strings from the provided file, sequences.txt. You may not use any libraries that assist you in completing this solution...
I have written the following Sudoku checker in Python. I feel like this could be written much shorter and perhaps more efficient. Especially the part with square_columns. rows = [] columns = [] squares = [] sudoku_sets = [] for i in range(9): if i == 0: row = input("Input the sudoku values row by row.\n") ...
It's been a while since I've done any sort of programming, and my first time in Python. I'm just looking for any general feedback and tips since this is my first program. # rock, paper, scissors game import random playerWin = 0 aiWin = 0 guess = 0 print('You are playing rock, paper, scissors. If you would like to quit...
I've been working on a course assignment for 'The Odin Project' and was hoping to get a review of my code. As per the help guide, the code is fully functional. The criteria for this was pretty straight forward. Try to have as little global code as possible. (At this point I've learned about classes, and modules) I feel...
Continued from the previous post - a brute-force approach to calculating all the vectors from 0 to n. I've come up with yet another solution, after I've realized that the vector takes up too much memory. But it is still not satisfactory, and is quite slow to the point that it is noticeable even on my local machine. I k...
I'm trying to create a stack library from scratch. It stores generic elements which are passed in void* pointers. This is the defined structure: typedef struct stackObject { void* obj; struct stackObject *next; } StackObject_t; typedef struct stackMeta { StackObject_t *stack; size_t objsize; int nu...
For my game I need to roll some values with a die. A die is formally described as: nDs[+a] n amount of die (optional, 1 of not set, zero must be set explicitly) D is a fixed part representing this expression as die s amount sides of the die/dice +a additional amount examples: 2D6 : 2 six-sided dice, result 2..12 2...
My task was to get the last 125 rows from an excel workbook. The rows are started from the 17th row and it goes until it can. Here's my code: Sub Get_Data_From_File() Const START_ROW As Long = 17 Const NUM_ROWS As Long = 124 Dim FileToOpen As String Dim wb As Workbook, ws As Worksheet, wsDest As W...
While setting up applications to communicate between various different trade partners and our WMS software I often have to parse very similar information from various different file formats. In this specific case i have to retrieve the tracking data from different files in csv, xml or json format. I've set up one templ...
Minimal Squares in a Rectangle Given a rectangle of dimensions \$a\$ and \$b\$, we want to divide it into the minimal number of covering squares. The following rectangle has a dimensions of 5 x 3. It can be cut into 4 squares: [ 3x3, 2x2, 1x1, 1x1] Implement a function that will take two numbers representing the side...
I'm reading "Modern C++ Design" (A. Alexandrescu, 2002). The author said "the standard memory allocator is awful for small objects", but it has been two decades after the book has been out, glibc's malloc was really hard to beat. Anyway, inspired from that, I wrote a simple allocator for fixed size object, in particula...
This is a follow-up to this question. Here I’m trying to do something useful with the format specifier. I guess I should have started with width and precision but foolishly decided to first try my hand at binary formatting. So here we go… #include <bitset> #include <charconv> #include <exception> #include <iostream> #i...
I made a weather app in react and redux for an interview. The response was that I didn't use redux properly, and that it has unnecessary props. I'm not sure what they meant. The app is on github https://github.com/s-e1/weather-app There are 2 pages in the App, Home contains SearchBar and HomeMain, HomeMain contains an...
I'm implementing a single linked list as close as it could be to std::forward_list. I would welcome a review and also more suggestions on what to test additionally. #ifndef LINKED_LIST_HPP #define LINKED_LIST_HPP #include <iostream> template <typename T> class LinkedList { private: struct Node { Node* next; ...
I made a simple battleship in C# console with a little AI ( just a little ) and The goal of this practice is improving my knowledge about OOP. Game Rules: 1.You Attack To The Enemy then he Attacked You. 2.if you do not find any ships with the help of Hint, one of your own ships will sink 3.I Write a Simple Little Small...
Updated previously posted string struct and utility functions Previous link: User-friendly string struct and utility functions What is updated ? typedef of sstring is a major update. previously, users had to do sstring var; and then var._str = value, But now, users can do sstring var = "Value"; Buffer overflows have b...
I'm trying to scrape arrival data from this website. My script takes extremely long time to scrape the data. Is there any way I can speed up the scraping process? Here's my script: import json import pandas as pd import copy import requests from bs4 import BeautifulSoup def getBalanceofTrade(): cookies = { ...
I have developed a web app which lets you transfer files from A device to B device, similar to airdrop's concept, working through the server and not peer-to-peer. I didn't go with a P2P solution because it requires a lot of time to make it work perfectly, and fallbacks in case it doesn't so I didn't really want to go i...
I had to make a single-page application that fetches some figures via an endpoint, does some calculations, and displays them to an HTML page. Below is my implementation. I know there is a lot of room for improvement. Looking forward to any feedback. const getNumberOfTitles = async (title: string) => { try { const...
I've been adding stuff a bit "blindly" to my controller and currently everything is working as it should, but the controller is gotten very messy. I'm using the gem rails_best_practices to tidy up my code, but it's currently not giving me any other fixes than moving some of the methods to the model from the controller....
Context: I am trying to perform a scan() on a DynamoDB table and apply some conditional operators to a filter expression. The operators however are passed in via AWS Lambda's event field. This means the operator is determined by an external user and my code needs to handle all possible cases. conditionAPIParam is what ...
I'm writing a GUI for different VME modules (electronics). There are several of them which are used for the data acquisition. For example, an ADC produces the digitized maximum voltage on its input. So I need a way to visualize this data. Almost always this way is a histogram. So I've chosen the Qwt library. The straig...
I have referred to this for what constitutes as an Euler Cycle: https://xlinux.nist.gov/dads/HTML/eulercycle.html This assignment required me to use Depth First Search and have the methods I have included. I am also required to use the Graph class provided here: https://algs4.cs.princeton.edu/code/edu/princeton/cs/algs...
I am a novice when it comes to C++ (as well as C++/CLI). I am trying to write a minimal 64-bit implementation of a List in C++ (using unsigned __int64 as the index data type), to store unsigned char values (bytes), as well as a C++/CLI wrapper for it that I will use to later to talk to it in C# land. I may have succeed...
This code cleans up a big dataset into a very clean and a flat file that can be further used downstream like visualization. I am expecting to improve the code to essentially run it faster and cleanup the code to avoid any inefficient functions that should not take further resources than it should. The problem is that I...
I was solving a DSA question, running median in a stream. And I decided to design my own stream class with additional features. template<typename T> class ActionInterface{ public : virtual void process(const T element) = 0; }; template<typename T,typename V> class Action : public ActionInterface<T> { ...
I'm learning java this week. Please reviews my code for BMI calculator using java, need some your feedback. Thanks before! This Assignment: My code public class bmiCalculator extends ConsoleProgram { public void run() { println("Person 1's information: "); bmiCalculation(70.0, 194.25); println(""); ...
Okay so I built this search page that searches for posts but my current code seems so bloated and inefficient. My script(search page) if(isset($_GET['title']))$title = $_GET['title'];else{ $title = ''; } if(isset($_GET['ad_brand']))$brand = $_GET['ad_brand'];else{ $brand = ''; } if(isset($_GET['min_range']))$min_range ...
This question seems similar to this one: Find number of unique paths to reach opposite grid corner but is entirely not. For moving from upper-left corner to lower-right corner we are not restricted to move only rightwards and downwards otherwise this will be a simple permutation and combination question instead. I came...
Here's my attempt at leetcode's container with most water. Problem: Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of the line i is at (i, ai) and (i, 0). Find two lines, which, together with the x-axis forms a...
The following code bellow is a factory which creates two different objects for marshalling cyphered and encoded output or the plain text default output. I'm concerned with a few things: different switch arms may have different dependencies, e.g.c.createCyphered(pgpPublicKey) vs c.createDefault() The pgpPublicKey, cyph...
Yesterday when I was showering I was thinking of branchless programming and a thought occurred to me, whether it's possible to write a branchless solution of the Fizbuzz problem. The constraints I put on myself were no if statements, no switches, no ternary operators and no loops. The code below seems to solve this pro...
I was wondering what might be the best way to inject Flask routes dependencies without a DI framework. I came up with something like this (CalculationService being the dependency I want to inject): from typing import Protocol from flask import Flask app = Flask(__name__) class CalculationService(Protocol): def c...
I've made a little app, YouTube Downloader, which does what the name says. I have three files as I am trying to get good enough in working with multiple files in one app. So even if it is really small I will try to separate it. I have some questions: Is my style acceptable? Is the code clean enough(I know there is not...
I am working on an integration software. I will need to download a list of products and import it into my website. The list of products will be downloaded from Constants.EndPoint which contains a zipped xml document. I will be downloading this file periodically (once every 4 hours) I have written UnzipClient which down...
I'm attempting to write an algorithm that will find the largest perfect squares of a given integer, subtracting their values from the total each time, as fast as possible. It's somewhat hard to explain, and I apologize for the somewhat ambiguous title, so I'll give some input/output examples: Input: 23 Output: [16, 4...
I'm new to C and was trying to write a generic dynamic array which is type safe. I'm not sure if I pulled it off in the best way possible though. dynarray.h: #ifndef h_DynArray #define h_DynArray #define DYNAMIC_ARR_SIZE 10 // Default size for dynamic arrays #define DYNAMIC_ARR_GROWTHRATE 2 //Growthrate for dynamic ar...
I have this code that controls the user permissions provided to a user. In my case, I constructed a simple example of CRUD. When the admin checks the boxes, it will grant the user access to perform that operation. For example, if I provide the user the ability to create, they can do so. The code works but I believe the...
I have this piece of code where it based on this condition: Box Color can only be in red, white and black If the box's type is A then any color is allowed Box's type C is not allowed at all For the gift, only green and blue color is allowed and the size cannot be small Box and gift color cannot be same views.py b...
This inspired by this C# question The basics is to calculate the total number of paths that a rook can take without revisiting a square to move to a diagonally opposite position. I tried to throw every possible tool in my rather limited toolset at this and got a pretty decent improvement. To calculate all the possible ...
As a part of library implementing websocket Guice scopes I need to maintain an object related to each HttpSession called sessionContextAttributes. Currently sessionContextAttributes is stored as an attribute of a session, which means the access and initialization needs to be synchronized: ConcurrentMap<Key<?>, Object> ...
I am trying to look for a substring in a list of strings. My end result is an array that contains the presence of substring first based on course.name and then based on course.description. Is there a better way to write the following code? Firstly, I am looking for the substring in the course.name field using the index...
I came across this BMC Genomics paper: Analysis of intra-genomic GC content homogeneity within prokaryotes And I implemented some Python functions to make this available as part of a personal project. The functions are these: import numpy as np from collections import defaultdict def get_sequence_chunks(sequence, wind...
My requirement is implementing a Queue<T> (where T is a Lexeme) that is capable of insertion sort and insertion merge. The Lexeme interface: /** * A lexeme is the smallest piece of data it is possible to * extract during the lexing process. * For example, a lexeme could be a keyword, a comment, or an identifier. * ...
As part of an assignment, I need to write a program which loads a colored image to the screen, converts it to HSI and displays each component in separate grayscale image. My program: #!/usr/bin/env python3 import cv2 import numpy as np import math from PIL import Image from io import BytesIO from matplotlib import pyp...
The most famous library for Support Vector Machine (SVM) algorithm is libsvm (https://github.com/cjlin1/libsvm/), but I felt that its code style is too old, I rewrote in newer C++ as a hobby project. Link : https://github.com/frozenca/ML_practice/tree/main/ML/SVM SVMData.h #ifndef FROZENCA_SVMDATA_H #define FROZENCA_SV...
The mission: Zero Trim Write a function which trims multiple zero's sequences to a single zero digit. The return value is the updated array. You are not allowed to use another array, and you need to implement it with one pass over the array. In other words, each element in the array should change its index only once du...
There are already many Tic Tac Toe posts. But as far as I can tell, none of the ones in Haskell are complete with a GUI Here is my implementation with Gloss. Gist Link for convenience module Board where import Data.Map (Map, (!)) import qualified Data.Map as Map import Data.List (intercalate) data Player = X | O ...
I am trying to learn rust and as such have been redoing some of the challenges on project Rosalind. This one relates to the challenge Enumerating Gene Orders. fn all_combinations(mut combinations: Vec<Vec<usize>>, chain: Vec<usize>, mut choices: Vec<usize>, max: usize) -> Vec<Vec<usize>>{ // filling options if...
I'm a back-end developer (in PHP and Python) and I use JavaScript mostly for DOM manipulation. Now I'm writing a chat app in Node.js and I'm not sure if my code is the cleanest. Here is how it works: Users open the chat page; We will match them randomly to another user; They will chat p2p. Here is what I have: When t...
I have a PHP API which echoes some data depending on the parameters in the URL: URL = "MyWebsite.com/MyAPI.php/username/password" When I try to access this API with Postman, I get the result within 5 seconds, however, using any Android device, I get the result at least 15 seconds later, under same network. Now I susp...
I was on Hacker Rank for the first time and there was a question that required to get the inputs from STDIN and use collections.namedtuple(). It was my first time working with getting inputs from STDIN so the way I acquired the inputs and used them to calculate the data might not be efficient. The question was to calcu...
In my .net core console application, I am reading multiple excel files and bulk copy data into a database table. It is working as it is expected, I wonder if there are any improvements to make it better. So I would be glad if you can share your comments. Thanks in advance. class Program { static async Task ...
my models class AssessmentTest(BasicModel): title = models.CharField(max_length=120, unique=True) class UserTestResult(BasicModel): assessment_test = models.ForeignKey(AssessmentTest, on_delete=models.CASCADE, related_name='users_passed') user = models.ForeignKey(User, on_delete=models.CASCADE, related_na...
I am writing my own parser for fasta format. I can't use Biopython or anything else, because it's a part of an assigment and our teacher wants us to try to do it manually. For now, I have done this: def read_file(fasta_file): "Parse fasta file" count = 0 headers = [] sequences = [] aux = [] with...
This is partially inspired by this question I have started creating an example to show how to keep certain parts of the array on disk and came up with the following: #include <fstream> #include <iostream> #include <vector> #ifdef _WIN32 std::string createTempFileName() { char buf[800]; tmpnam_s(buf, sizeof(buf...
I wrote the following code to read out a bill from a file and then putting it into a bills-list. The bill contains: "company", "customer", Year, Month, Day, Amount, "credit/debit" Is there a nicer way using list comprehension to make this code look better? def read_bills(file = "bills.csv"): """Read bills from the ...
Have you ever written proxy objects, instead of using a setter and a getter method? In that case, I'm interested in your opinion on the following design for a templated proxy. This is a second version, after addressing comments from a previous review; it is intended to work with C++11 or newer. Issues which have been a...
I've implemented this rotate_ algorithm mimicking STL's : The algorithm left-shifts all the elements n times where n is the distance between the first element and the axis (middle): template <typename InIt> InIt rotate_(InIt first, InIt Rit, InIt last){ if(first == last) return last; if(Rit == first) ...
Brief Background: I just started learning Android Development recently. I have some experience with programming and understand the basics of OOP but am not confident that I am using principles of OOP properly. In the App that I am working on, I am using a Nested RecyclerView. Since posting the code from the Actual App ...
This is a Python 3 module that generates random pronounceable word-like strings based on Markov Chains. It has many modes, each mode conforms to the structures of dictionary words to a degree, the two highest conforming modes use Markov Chain trees, with the output of THE highest conforming mode practically indistingui...
Recently I've started to learn the C programming language. This is my first program which finds zero places of quadratic formulas. Doesn't parse, just gets the discriminants, counts delta and x1, x2. #include <stdio.h> #include <stdlib.h> #include <math.h> void set_number_from_stdin(int *num, char* buf) { int fina...