letter and word counter

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Apr 2004
Posts: 4,386
Reputation: Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future 
Solved Threads: 243
Team Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: letter and word counter

 
0
  #11
Dec 15th, 2004
Originally Posted by 1o0oBhP
Do you use Dev-C++? I have 4.9.9.0 and if anyone knows how can i observe vaiables at run time??
I have Dev-C++, but don't use it much. I think there is a way and seem to remember something about gdb, but I'm not familiar with its use.

I just tend to use output statments to see values at runtime ("debugging with printf").
#include <stdio.h>
#include <ctype.h>

int main(void)
{
   char text [ 20 ] = "Hello world\n";
   size_t i;
   for ( i = 0; i < sizeof text; ++i )
   {
      printf ( "text[%2d] = ", i );
      printf ( isprint ( text [ i ] ) ? "'%c'" : "%d", text [ i ] );
      putchar( '\n' );
   }
   return 0;
}

/* my output
text[ 0] = 'H'
text[ 1] = 'e'
text[ 2] = 'l'
text[ 3] = 'l'
text[ 4] = 'o'
text[ 5] = ' '
text[ 6] = 'w'
text[ 7] = 'o'
text[ 8] = 'r'
text[ 9] = 'l'
text[10] = 'd'
text[11] = 10
text[12] = 0
text[13] = 0
text[14] = 0
text[15] = 0
text[16] = 0
text[17] = 0
text[18] = 0
text[19] = 0
*/
Last edited by Dave Sinkula; Dec 15th, 2004 at 4:06 pm. Reason: Added code.
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 4,055
Reputation: vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice 
Solved Threads: 935
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
DaniWeb's Hypocrite

Re: letter and word counter

 
1
  #12
Dec 15th, 2004
Originally Posted by 1o0oBhP
fair enough. Im used to Programming in VB (6 years and before i learned c++) where you can observe variables at run time (ie wats in the string). however my c++ IDE doesnt.... so i dont know what is going on i have to make certain nothing can go wrong
Do you use Dev-C++? I have 4.9.9.0 and if anyone knows how can i observe vaiables at run time??
Console debugging has problems with old Windows and Dev C++ versions. You should be okay with version 4.9.9.0
Here is the poop:
Debugging with Dev C++:
Make sure you are using a project!
Go to Project Options > Compiler > Linker and set Generate Debugging Information to yes. Make sure you are not using any optimization options or the strip option!!!
Now do a full rebuild with Ctrl-F11, then set breakpoints where you want the debugger to stop. To set a breakpoint on a line, put your cursor on the line and press Ctrl-F5 (or click on the gutter left of the line). You can add or remove breakpoints during the debug session, but need to have at least one to start with.
Launch the debugger clicking the debug button (or F8). The program stops at the first breakpoint. You can step through the code and enter function calls, by clicking on the "step into" button (or Shift-F7), or stepping over the function calls, by clicking the "next step" button (or F7). To go to the next breakpoint click the "continue" button (or Ctrl-F7).
When the program is at a breakpoint, and you are stepping through the code, you can display the values of various variables in your program by putting your mouse over the variable name. You can also display variables and expressions by pressing the "add watch" button (or F4) and typing the expression.
This info should be in the help included with Dev-C++.

I do prefer Dave's way of run-time debugging, just offset the code a little so you can remove it later.
May 'the Google' be with you!
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 4,055
Reputation: vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice 
Solved Threads: 935
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
DaniWeb's Hypocrite

Re: letter and word counter

 
0
  #13
Dec 15th, 2004
Back to the question at hand.
You can implement a frequency table via the binary search tree that is the basis of map from the Standard Template Library. There was a code sample posted by Narue on this very merry forum not too long ago.
May 'the Google' be with you!
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 445
Reputation: 1o0oBhP is an unknown quantity at this point 
Solved Threads: 6
1o0oBhP's Avatar
1o0oBhP 1o0oBhP is offline Offline
Posting Pro in Training

Re: letter and word counter

 
0
  #14
Dec 15th, 2004
cheers vega, i overcame the problem in the end anyway using an html logfile -> easier to read and break up into tables for arrays ect...

What is the problem (if any) with the frequency counter?? looks ok at first glance, hows the project going chriswell? Would be interested to see if you got the whole source working correctly!
http://sales.carina-e.com

no www
no nonsense

coming soon to a pc near you! :cool:
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 1
Reputation: bgunn is an unknown quantity at this point 
Solved Threads: 0
bgunn bgunn is offline Offline
Newbie Poster

Re: letter and word counter

 
0
  #15
Jul 21st, 2005
I know that this is way late but just found this site and this IS a program that our company is interested in... actually, we have a similiar program already in use but it was written way back and we are hoping to upgrade the system that the program is on.

The counter currently works on a Win98SE with an LPT 1 direct line to an Epson dot matrix printer. Have tried it on WinXP Pro and no go. So this is one item that is holding us back.

Has anyone found or written this type of program?

bg
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC