473,569 Members | 2,900 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

writing a program in C to calculate delta between two numbers

3 New Member
I'm a very new programmer.
I have a sorted file and want to calculate delats between the numbers. That is calculate the difference between first number in line 1 and second number in line 2 (delata1), difference number 3 in line 3 and number 2 in line 2(delta2), .... so on.
Then calculate mean of these deltas, variance, standard dev and then ratio standard dev to mean (stand dev/mean).
Can have any sample/example files.
Thanks for your help
Mar 1 '07 #1
6 5657
3,652 Recognized Expert Specialist
Well, in order to do that, you'd have to read in the first 2 numbers, then subtract them and store this value into your delta array. You should have 2 integer values (for the two numbers to subtract) and an integer array (for the delta values). You can write a loop to continue finding delta values for the entire file, storing them into the array.
Mar 1 '07 #2
3 New Member
any sample file you can share with me?
Mar 1 '07 #3
4,677 Recognized Expert Moderator Specialist
any sample file you can share with me?
We are not allowed to write your homework for you, but if you try it and get stuck, we will help you if you post the portion of code that is returning the error, and explain what you have done to try to fix it.
Mar 1 '07 #4
3,652 Recognized Expert Specialist
Do you mean a sample file filled with numbers in ascending order? I think we can do that, since he'd still have to write all the code himself...
Mar 1 '07 #5
3 New Member
Yes, sample file fiiled with numbres in asscending order
Mar 1 '07 #6
3,652 Recognized Expert Specialist
OK, try

5 7 9 11 14 19 40 50 51 60

10 random numbers I picked off the top of my head.
Mar 2 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

by: GM | last post by:
Hello. I am starting my 7th week of an intro to programming class and have a problem I have been working on. My instructor said we could look for source code on the internet and use it as long as we tailor it to fit the problem at hand. I have not been able to attack this one with any kind of success! Does anybody know of a URL that I can...
by: hpy_awad | last post by:
I am writing stings ((*cust).name),((*cust).address)to a file using fgets but rabish is being wrote to that file ? Look to my source please and help me finding the reason why this rabish is being written. /* Book name : File name : E:\programs\cpp\iti01\ch10\ex09_5p1.cpp Program discription: Adding name,Address to...
by: cj | last post by:
Thanks to everyone that has helped me. Now I'm trying to write my first program. I have an example of one that I need to write about. Any help getting me started is appreciated. I'm having trouble getting my compiler to work, access to my a drive is denied, anyone know why this is? Ok here is the info for my program: The two laws of...
by: Willing 2 Learn | last post by:
Below is a program I did to recognize a Finite State Automata for ASCII (J+H)*. I got that one working but im having trouble getting the NFA program to work. I really desperately need help! My NFA has initial states: 2 and 12 ending states 2 and 12 I need help to switch program below from FSA to recognize NFA. I was...
by: ehabaziz2001 | last post by:
I am facing that error message with no idea WHY the reason ? "Abnormal program termination" E:\programs\c_lang\iti01\tc201\ch06\ownarr01o01 Enter a number : 25 More numbers (y/n)? y Enter a number : 30 More numbers (y/n)? n
by: Hemal | last post by:
Hi All, I need to know the memory required by a c program. Is there any tool/utility which can give me the memory usage in terms of DATA segment, TEXT segment, BSS segment etc. I am working on linux platform and my target is ARM processor. But i guess it should not matter. Actually i need to know both RAM & ROM usage.
by: lavicool | last post by:
Hi all, I just joined the post. Iam new to C programming. I have a question regarding a problem for my assignment. The problem is i have a input file with student ID, 5 program scores, midterm and final score. i have to check for wrong input of data(negative score),calculate average score for program,calculate student totalscore (30% of...
by: rohitsripathi | last post by:
i need help writing this program... i am in college and i do not have time do this right now as i need to study for another test....but this is due tonight...i will pay $5 if you accept to do it and i will pay another $10 upon completion> CISY 103 - Project 01 - Fall 2007 - 02x Daily Sales report for Kahuna Burgers Overview The manager of...
by: rahulsengupta895 | last post by:
. #define MIN(a,b) (a<b?a:b) #define MAX(a,b) (a>b?a:b) #include "Video.h" #define NO_HUE -1
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.