float grades[10]
You're telling the system to create an array of 10 floats containing indexes 0 through 9.
for ( i = 1; i <= 10; ++i )
And you're now telling the system to iterate from the...
Type: Posts; User: Amberlampz
float grades[10]
You're telling the system to create an array of 10 floats containing indexes 0 through 9.
for ( i = 1; i <= 10; ++i )
And you're now telling the system to iterate from the...
Aye, I think I got reverse-confused :P. Thanks for pointing out my error. Still, I would probably avoid having both floats and doubles(just for less confusion's sake) unless there's a convincing...
You're printing out doubles as floats.
edit: grumpy corrected error
Read about how to write a main function and while loops.
Considering you're not returning anything (and you're using void main :(), it should be getting garbage values/runtime error/etc. I don't know about your compiler(s), but it may just be "correcting"...
Make sure you're completely clear about your instructions (considering an assignment like this does not seem reasonable for any class in C). I would think it easier to "pass two dimensions" if you...
This is wrong:
for(i=0;i<5;i++)
{
for(j=0;j<5;j++)
if(a[i]==a[j])
{
freq++;
}
C File I/O Tutorial - Cprogramming.com
Read this. You're opening the file in write mode in both instances.
In addition to what's being mentioned, you don't need math.h and you should get rid of the elseif() and just change it to a single if() statement.
Look at line 27.
Try to break your code up into individual functions. Your teacher is really, really not going to like you if everything is plugged into main. It also helps a ton for you, because you can figure out...
If you've taken two courses in Java I don't see how this could be so difficult. You've covered far more extensive and difficult topics than what this asks of you. The thing that might be a little...
C, C++ Programming Tutorials - Cprogramming.com
Start reading, I guess. You've got a long way to go syntactically if you don't know how to input values from the keyboard.
As far as mode...
His criticism isn't unwarranted. Tater is pointing out things in your code that are likely to cause an error and asking you to fix them. It could very well be the case that the problem resides in...
Something I read elsewhere:
"Define a 10 character buffer and gets() will happily accept the Declaration of Independance as its input."
It may not be a problem right now, but you're absolutely...
I'm curious why a final project is accepted without modular code or good format, but eh.
I was about to test this myself and see if I could find the error, but it's good to know that you figured it out. I'm not exactly what you'd call a coding guru, but I think it would definitely help...
Wow. It's almost hilarious how the simpler answers are the hardest to come by. After sleeping on it I deduced that pointers wouldn't really be needed unless I wanted to over-complicate things. ...
Noted, and thanks.
Given any set of numbers stored in an array, I compare an array index with the one above it, and if they're equal I increment a counter. These counter values are then...
Unfortunately the compiler I'm using is Visual Studio 2010 (and they apparently have no plans to implement it). Is there a workaround, or would you suggest another compiler?
Not quite. I'm...
Thanks for the quick response. Hmmmm. I'm afraid I don't quite understand what you mean. I went ahead and changed some things around to make it simpler, though.
void hurrmode (int array[],...
Hello again. I'm looking to calculate a mode in an array, but I've run into a few problems with the syntax. I believe my general methodology would work well, though:
1. Go through the array
2....
Hey, look at that; I'm retarded.
Program works. Thanks for the help!
Thanks for the quick response.
Okay, so making those changes and adding the printf in the function makes it look like this:
void hurrdurr (int array[], int size)
{
int i, j;
for (i = 0;...
Hello, before I go further I would like to state that this is not for a homework assignment, but I would still prefer if I wasn't given the answer right off the bat. My goal is to write a very...