User Profile

Collapse

Profile Sidebar

Collapse
jfwfmt
jfwfmt
Last Activity: Dec 28 '09, 12:53 AM
Joined: Nov 6 '09
Location: Fairmont WV
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • or try game learning machine

    Pick a simple game maybe enlarged tic-tac-toe (3 dimensional, or more than 9 boxes) or maybe a 4x4 checker game. Devise a learning machine that rewards a path to winning by incrementing numbers in link(s) and punishes a path to losing by decrementing numbers in link(s). Make it play both as the first mover and the second mover.
    Play it against itself and remember the link numbers. It should learn...
    See more | Go to post

    Leave a comment:


  • jfwfmt
    replied to STL error message in g++
    in C
    Got it to work

    after making the target const and a little more massaging, the following works:

    [code=c]
    #include <string>
    #include <queue>
    using namespace std;

    typedef string (*attr_func_T) (const string);
    typedef const string attr_arg_T;

    class multi
    {
    public:
    string invoke (void)
    {
    ...
    See more | Go to post

    Leave a comment:


  • jfwfmt
    started a topic STL error message in g++
    in C

    STL error message in g++

    I'm trying to get the class multi to store a series of function/argument pairs. The functions are of the form:
    [code=c]
    string funcA (const string argA)
    [/code]

    I thought that I had all the signatures matching in:

    [code=c]
    #include <string>
    #include <queue>
    using namespace std;

    typedef string (*attr_func_T) (const string);
    typedef ...
    See more | Go to post

  • jfwfmt
    replied to Size of primitive types platform vs language
    in C
    Java is a language that (0riginally) compiled into byte codes which are opcodes for a specified (non-existant) machine. The machine in implemented in a Java Virtual Machine. This machine has a defined length of the integers, characters .... The idea was write once, run on many different machines with no changes to the byte codes, just to the JVMs.

    /s/ Jim WIlliams
    See more | Go to post

    Leave a comment:


  • check on whether char is signed or unsigned by default

    /s/ Jim WIlliams
    See more | Go to post

    Leave a comment:


  • C++ STL to generate HTML for vertically alphabetized table

    presented for editing and comment

    The article is about using STL components in processing data and producing a <table> with the elements sorted vertically. The ideas in the program demonstrating STL use are interesting IMHO and the generation of vertically sorted tables is useful for some applications.

    /s/ Jim WIlliams

    Both files use UNIX line termination

    The article text is in HTML...
    See more | Go to post
    Last edited by Niheel; Sep 1 '24, 06:20 PM.

  • jfwfmt
    replied to how to read a txt file into an array
    in C
    You are probably not checking for end of file correctly. Look at the documentation of .get() and its friends (google get())

    /s/ Jim WIlliams

    also note that 0-037, 0177 and 0200-0237 (octal) are not directly printable
    See more | Go to post

    Leave a comment:


  • jfwfmt
    jfwfmt posted a Visitor Message for drhowarddrfine
    I've written a C++ STL function that generates xtml to build a table of words in alphabetical order by column (vertically) rather than by row. I find alpha by column easier to read. Would it be reasonable to post it as a shared insight? If so should it go into C++ or HTML? Also would a code review be a good preliminary to posting an article?

    Thanks

    /s/ Jim WIlliams

    (Message also send to weaknessforcats...
    See more | Go to post

  • jfwfmt
    jfwfmt posted a Visitor Message for weaknessforcats
    I've written a C++ STL function that generates xtml to build a table of words in alphabetical order by column (vertically) rather than by row. I find alpha by column easier to read. Would it be reasonable to post it as a shared insight? If so should it go into C++ or HTML? Also would a code review be a good preliminary to posting an article?

    Thanks

    /s/ Jim WIlliams
    See more | Go to post

  • jfwfmt
    replied to Segmentation Fault using fprintf (really weird)
    in C
    I believe you are probably reading a line from your input file that is missing a token.

    Try checking the token value for NULL before passing it to atoi(), then printing a error message and exit. If this shows up a problem, I'd then count input lines as I read them in and print the line number as part of the error message, this will make it easier to find the bad line in the input file.

    Checking for NULL is good defensive...
    See more | Go to post

    Leave a comment:


  • found the solution in Meyers, Effective STL item 22

    Thanks, your hint about const ness was the clue. It turns out that STL implementations differ on the const of set objects. GNU makes them const.

    Meyers shows a workaround for non-key data members of the objects in the set, using a cast to alter the const ness of the reference

    Code:
    const_cast<key_word_T&>(*global_itor).inc();
    is...
    See more | Go to post

    Leave a comment:


  • error message text

    Thanks for the style suggestions

    Code:
    global_itor->inc();
    and
    Code:
    (*global_itor).inc();
    produce the identical error message (g++)

    error:passing 'const key_word' as 'this' argument of 'void key_word::inc() ' discards qualifiers
    See more | Go to post

    Leave a comment:


  • jfwfmt
    started a topic how can I reference a member function using a SET itor
    in C

    how can I reference a member function using a SET itor

    Please pardon my ignorance. I'm writing a C++ STL program after not writing code for 7 years, I'm trying to invoke key_word.inc() using an iterator for a set containing key_word_T. The following is a pared down version.

    Code:
    #include <cstdlib>
    #include <set>
    #include <string>
    using namespace std;
    
    class key_word
    {
    public:
      string word  (void) const         { return
    ...
    See more | Go to post
    Last edited by Banfa; Nov 6 '09, 09:26 PM. Reason: Added [Code]...[/code] tags
No activity results to display
Show More
Working...