C Programming

  kentylad 16:36 26 Nov 2003
Locked

I have a question which to be honest, I wouldn't have thought could have been answered here.

It's a programming question, and would want to know whether anyone could answer it or whether I should ask it elsewhere i.e. a programming forum.

Any suggestions?

Nick

  spikeychris 16:42 26 Nov 2003

Why not ask the question Nick and see.

  kentylad 16:48 26 Nov 2003

Well I wanted to know wether anyone had any knowledge of C.........no point in typing out my problem if no-one can answer it (!)

Anyhow, seeing as you're asking i assume you know a thing or two Chris?

Well, I have written a simple program which will calculate various mathematical functions such as the mean and standard deviation, of a number of values read in from a file (using FILE POINTER)

I have successfully done this within the main function, and would not like to include any other functions other than this. I hvae been having trouble with how to print out the 'largest' and'smallest' numbers read in from the file i.e. if the file contained -1 2 -7 4 8:

Largest = 8
Smallest = -7

I also haven't used arrays

regards

Nick

  spikeychris 16:51 26 Nov 2003

Think the overhead grommets gone and the reversible flange is damaged.

  tbh72 16:58 26 Nov 2003

Starts to reference Deitel & Deitel, bear with me, but I suspect you need to include a sort command?

  kentylad 17:05 26 Nov 2003

"Think the overhead grommets gone and the reversible flange is damaged."

ummm............nice one (!)

  R4 17:11 26 Nov 2003

When you've read the file do you get a result returned from your function like 'Largest = 8 Smallest = -7' if so use one of the (s)printf functions to print out 'Largest','Smallest'

  tbh72 17:11 26 Nov 2003

click here

I wont pretend to be a C expert, I have provided a link to the deitel website d/l area, scroll down the page where you will find downloadable C examples. You should be able to extract a solution from the examples provided.

Sorry I couldn't be more help?

  spikeychris 17:12 26 Nov 2003

Sorry, not a clue. What I know about C could be written on a fag packet. But it got someone on the case.........

  kentylad 17:18 26 Nov 2003

This is literally what it does; opens the file, reads the data from the file but doesn't return anything.

The program uses the values read in to calculate the mathematical functions etc

Nick

  kentylad 17:20 26 Nov 2003

This is what i want to do! I want something to return 'Largest' and 'Smallest'

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

Fujitsu Lifebook P727 laptop review

Converse draws on iconic heritage for a fresh brand identity

Mac power user tips and hidden tricks

Comment lancer Windows 10 en mode sans ├ęchec ?