Oh my god! I got it:D Thank everyone for the help.
I based my program off of a character counting sample our teacher gave us and I never quite understood it. Can anyone care to explain this code?
...
Type: Posts; User: hufnagel
Oh my god! I got it:D Thank everyone for the help.
I based my program off of a character counting sample our teacher gave us and I never quite understood it. Can anyone care to explain this code?
...
I think I messed up on what I was trying to say. If I comment out that part, it will display every word in a text file correctly, but not counting each unique word.
So, I think the while loop is...
I need help with an assignment. I am trying to make a program which reads a text file, separates the strings into words, then finally saving and counting each different word.
When I comment out...
I've finally got it! Thank you so much for the help.
There was roughly a 0.05 second difference between the normal one and the pointer one.
Changed the j=a+1 to j=i+1. What a stupid mistake...
Here is my current code;
#include <stdio.h>
#define MAX 20000
#define RandMax 1000
void select_sort(int a[], int n){
int *i, *j, *min, t, *last;
last=a+n;
for(i=a; i<last; i++){
Use pointers to index 'rcgldr'. I'm kind of confused. I tried to swap the elements instead of the pointers, but it's not doing any good...
I am trying to work on an assignment where I need to change the selection sort function code to use pointers to handle the arrays, so it takes less time for the program to run. (Using MSYS in Windows...
Oh, I've missed a simple typo.
I've fixed it, but it still doesn't read correctly...
I think the way I'm storing the strings are messed up.
I've forgotten to put up the file I want to read:
...
I'm trying to make program that will read text from a file and show what words occur how many times.
I'm trying to make it so that if a new string comes, it saves it into wlist[], and counts 1 to...
This is what I'm trying to display:
The top 3 sales for Jan is
Ballpoint pen A 58
Note C 46
Note A 34
The top 3 sales for Feb is
[product name] [number sold]
and so on for every month...
I've made two C programs.
The first program writes a binary table to 'sales.dat'.
The second program is what I have a problem with.
I want to sort those numbers in two ways by reading the binary...