I JUST DID THAT AND IT WORKED!!! thanks so much!! :)
Type: Posts; User: kal123456
I JUST DID THAT AND IT WORKED!!! thanks so much!! :)
so would i do something like this?
int num_rows = namesArray[0][0];
since the first row and column of the array is 16 in this case? the teachers doesnt really want us to output the number...
@AndiPersti Thanks, I actually got my program to print the table correctly! the only problem is that now I want the first element of the array not to be read...for example, the names.txt file looks...
Ohh ok, that makes sense that i would rather use what I already defined then creating new integers, thanks! and I fixed up my code, I made the getSales function look exactly like the getNames...
Ok, i'll indent it right now!
and in the getSales function, i wrote:
int col=6;
int row=25;
so i made the max number of columns be 6, and the mas number of rows 25. I also defined...
I'm really sorry that I'm speeding through this, but it's due by today midnight, and I'm just really nervous -___- Thanks for clearing the fgetc thing out! I'm using that in my code now, so the...
Oh, and also, I'm not allowed to use strings when I read the names....Im supposed to read in one character at a time...
@Matticus -- Yes, i just read the link!! I tried doing what it said in the link, but my code got all messed up, so I'm trying to see if nonpuz's way will work....I'm so confused!!
@nonpuz -- I...
no it doesnt!! i had to add what @camel-man suggested,
if(namesArray[i][j]==',') printf("\n");
However, now it outputs a slightly different output, the commas are misarranged!! it looks like...
ya im on a windows machine and here's my code:
#include <stdio.h>
#define INPUT_FILE_GET_NAMES "names.txt"
#define INPUT_FILE_GET_SALES "sales.txt"
#define MAX_ROWS_NAMES 25
#define...
OMG.........it actually works!!!! only now, the last problem, how do I get it to look exactly like the txt file? like this:
16
Kelly, Victor
Lam, Gary
Nagasake, David ...
Ohh ok, so I changed the %d to %c which means that now it should be printing characters instead of integers. However, now it doesn't output anything, just a blank space haha.....what do you mean by...
Ohhh, so then how do i change it to read characters?
ok now i get it to print something, but instead of printing out the contents of the txt file, it just prints:
0000000000000000000000000
Process returned 0 (0x0) execution time : 0.055 s...
Ohh ok! I don't think I'm gonna make one function do the same 2 things, cause my teacher prefers us to write 2 separate functions, but thanks for letting me know, i'll use it in the future! so I just...
OMG thanks so much for clearing that out! and actually, I changed up the parameters a bit, so now there's only one parameter, and I changed the way I open my file, similar to the pseudocode you...
I just removed the second parameter from the getNames function, now my code looks like this and it will run and then crash....PLEASE HELP!!
#include <stdio.h>
#define INPUT_FILE_GET_NAMES...
ok so i'm trying to make a separate function that will read from a txt file into a 2D array...somehow it's not working :( it keeps on saying that "filename" is undeclared....help please, thanks!!
...
yeah could you please give more details? thanks!! :)
@zw_hat Thanks for the great code!! I think i might use fgets then, it's probably easier haha! btw, in line 35 of your code, what are the ... ? :)
Hey everyone, so I have this following code, and what I'm supposed to do is this (assignment copied and pasted below):
The following table shows the total sales for salespeople of the ABC...