Thanks for the ideas here.
Type: Posts; User: JDGATX
Thanks for the ideas here.
MENSA puts out these weekly word puzzles. For whatever reason I decided to try and write something which would solve them. The puzzles take the following format:
... where the underscore...
My version would not compile without the prototypes, so I was throwing that in there.
I didn't have any real substance to offer up, just cosmetic changes to better the code.
A few things that I've noticed.
You need function prototypes declared at the top of your source.
int readDataAndWriteRecords(void);
Student* getOneStudentFromData(void);
void...
Don't use fflush(stdin). Undefined behavior.
Show some code and some effort, please.
I'm missing a lot of things on this post. I'll slink back to the darkness.
Try %f.
Run a search for fopen(). This function establishes your file pointer, which is FILE * in type.
Good catch. My apologies.
You're just missing a closing curly brace for this statement:
if ( bytes > 0 )
...inside your while(!eof) loop, which, incidentally, is not the correct way of using EOF to control a loop....
Search the forum. This exact question has been asked prior and solved.
That's all fine and good that you don't need to submit your main() to your teacher, but you won't be able to test your function in any compiler without giving it a main().
You have to have a main function. Something like this:
int main(void)
{
int a;
int b;
int w;
int n_a;
Where do you actually populate str?
And I don't think that's the correct call of sprintf(), but I'm unsure from memory.
We see this problem rise up with argc and argv, where argv is the collection of arguments stored as char** and argc acts as the counter of arguments in the char**.
atoi() takes char *, not char. Which is to say, it takes a string.
You need a semicolon in your .h file after your function prototype.
#include <stdlib.h>
#include <stdio.h>
#include <GLUT/glut.h>
int incrementI(int num, int dir);
for (j = 0; j < NUM_ROWS; j++)
{
for (k = 0; k < NUM_COLS; k++)
{
printf("%2c", grid[j][k]);
}
printf("\n");
}
You're missing a } at the end of DrawGLScene, if my eyes do not deceive me.
Also, you're defining a few variables in the middle of your functions, which is not standard C.
For example, you're defining variables in the middle of your function.
You need to eat up the newline character. Look above at my code. You'll see how I added a %*c to eat up the newline.
Also, your brackets and indentation are screwy. Again, look at my code. It...
You're reading the values in from a text file, correct? This means that charIn will hold the value of each card once you read that in. Since it's a char data type, you just have to check to see what...
Which means you have to pass "type" by reference from main() to search_array().
I've got a working program that does what you want, so feel free to ask any more questions you have.