![]() |
C Code Problem
Hey all...
Is anyone here any good at C Programming?... I have a problem, and if anyone is anygood or can code in C then i will post my problem... Thanks all... |
I do mostly C++ programming, so PM me your prob.
Regards Stoneyx |
I have done a lot of C, lets see the problem.
|
Let's see it.
Its probably == in place of = or a missing ; or a ++ operator in the wrong place... or it could be something funky such as arrays of pointers to functions which are going to unprotected memory!! |
C'mon, post it here!
I used to write C for a living, would be good to "put my coding trousers back on" and have a go!!! RC |
Hey, i will post some problems later, i seem to have many =). But its ok if you just help with the C code ones...
I got my initial problem solved by Stoney X. But i have 12 different tasks i am stuck on, i have completed 30 or so on my own, just getting a little stuck with the more complex things. I am at Uni right now, but when i get back i will post the problems for all to help =) Thanks all... |
Hello Again All...
here is my C Code problem... A Ball is thrown upwards at a speed of 15m/sec, it rises in the air and falls again. Display a table of the heights at intervals of 0.2second from the time it is thrown untill it reashes the ground. the formula for the height at any point in time is: height = 15 x time - 4.9 x time(squared) keep the ball going untill the ball falls below zero ----------------------------------------------------------------------- Thanks for any help on the above, its got me... Once completed, there are variables, but i am ok at added different variables in, like changing speed, but the whole sum and loop thing is over my head... Thanks agian... |
Okay, here's my punt. Caveats are (1) I haven't written C for 5 years at least and (2) I don't have a C compiler so may not even compile!!!
// Include the Standard IO header #include <stdio.h> void main() { // t represents time // h represents height of the ball float t,h; // initialise both to zero (ie at time 0, height is 0) t=0; h=0; // loop until height goes negative (ball falls below zero) while (h>=0) { // height = 15 x time - 4.9 x time(squared) h=(15*t)-(4.9*t*t); // print time, height and a new line printf("%f %f\n",t,h); // add 0.2 seconds to time t=t+0.2; } } |
Well it runs ... output is
0.000000 0.000000 0.200000 2.804000 0.400000 5.216000 0.600000 7.236000 0.800000 8.864000 1.000000 10.100000 1.200000 10.944000 1.400000 11.396000 1.600000 11.456000 1.800000 11.124000 2.000000 10.399999 2.200000 9.283998 2.400000 7.775997 2.600000 5.875996 2.800000 3.583995 3.000000 0.899993 3.200001 -2.176008 DJGPP Public Access Cross-Compiler RC |
Thanks for that Craig, the app works great, and thanks for the anotations, i now actually understand whats going one, so thanks, your better than my Uni teacher...
I use Dev C++ from http://www.bloodshed.net Its a compiler and GUI wordpad type of thing, and its free... Thanks again... |
Hey Guys/Gals
I need some help once again... I have to make a programme that inputs can be entered in, stored, deleted, edited and added after the initial add, but for some reason i am having issues with adding extra fields to an array. Here is the flow, User inputs how many records, a loop is run until x is reached and the loop increased the values of the array each time. I need to add extra records to the array after records have first been input. I guess i need some way to find out how many records have been allocated and retreive them and add one to the last record? Im not 100% sure, so anyhelp would be of use. Here is what i am doing # Built a programme to enter in the names and ages of friends. The programme must be able to add x friends, one friend, and 20 friends in bulk. It must also have a list feature and search. The records must also be able to be edited and deleted. In addition, the programme must be able to add records after initial records have been entered. Thanks again,... |
| All times are GMT. The time now is 12:12. |
Copyright © 2026 MH Sub I, LLC dba Internet Brands. All rights reserved. Use of this site indicates your consent to the Terms of Use.