Search:

Type: Posts; User: WaltP

Page 1 of 20 1 2 3 4

Search: Search took 0.02 seconds.

  1. Replies
    39
    Views
    6,309

    I'm a little late to this problem, but I would...

    I'm a little late to this problem, but I would like to clear up a couple assumptions:

    1) each line is one "serial number"
    2) each serial number is 5 numbers separated by space
    3) the order if...
  2. Jeez. A-Z + 0-9 = 36 possibilities ...

    Jeez.
    A-Z + 0-9 = 36 possibilities


    string[i]=(rand()%36)+'0'; // get 0 to 35, add '0' to convert to number
    if (string[i] > '9') string[i] +=7; // if above '9', convert to letter
  3. Replies
    4
    Views
    986

    Read in an integer As stated above, use the...

    Read in an integer
    As stated above, use the modulus function to get the *last* digit
    A simple WHILE loop will suffice, recursion overkill
  4. Thread: Timer in C++

    by WaltP
    Replies
    16
    Views
    1,869

    So nobody bothered answering his question -- just...

    So nobody bothered answering his question -- just arguing about a completely unrelated issue. Helpful.

    Look into the functions defined in the ctime header, specifically time().
  5. Replies
    11
    Views
    2,138

    I disagree. If I run across a variable halfway...

    I disagree. If I run across a variable halfway down the page of code and it's not its first use, how do I know where its definition is? I have to search all through the code up to that point to find...
  6. Replies
    4
    Views
    4,290

    Where do you test for ESC?

    Where do you test for ESC?
  7. Replies
    15
    Views
    2,099

    What I would recommend is reading your binary...

    What I would recommend is reading your binary value as characters (string). Then you can enter the entire binary value as discrete digits.
    Then loop through that array until you hit the null at the...
  8. Replies
    4
    Views
    808

    For what you require, you don't need any sorting...

    For what you require, you don't need any sorting algorithm. you simply need to read each word in the sentence and compare it to your target word.

    Look up the read functions (scanf, fgets, etc)....
  9. Think about this section more critically: ...

    Think about this section more critically:


    counterb = 0;
    if (decb % 2 != 0) {
    counterb++;
    } else {
    counterb = 0;
    }
  10. Replies
    5
    Views
    8,289

    You know you could make your loops simpler by...

    You know you could make your loops simpler by using
    for (i=499; i>=0; i--)
    It would be easier to see what's happening.

    Easiest way to debug something without using the debugger is to print...
  11. Version 1: #include #include...

    Version 1:


    #include <stdio.h>
    #include <stdlib.h>
    #include <time.h>

    #define MAXSYM 20
    #define OUTCOL 13
    unsigned char symbols[MAXSYM] = { 128, 135, 143, 145, 156,
  12. Replies
    11
    Views
    19,890

    Yes. Much better -- because it's safer.

    Yes. Much better -- because it's safer.
  13. Replies
    28
    Views
    3,980

    You'd be better off using the other technique...

    You'd be better off using the other technique mentioned above using the values from the ASCII chart and doing a simple math equation. You'd save yourself about 65 line and get rid of the switch....
  14. Replies
    28
    Views
    3,980

    And when you get to the next language that...

    And when you get to the next language that doesn't have an strtol-like function, you are a cripple. C is not the only language out there. and presumably is not the last one to be learned.

    I've...
  15. Replies
    9
    Views
    1,785

    That's easily done by starting with a zeroed...

    That's easily done by starting with a zeroed array and for each roll, using the total as an index to increment that value in the array


    Is this an assignment requirement or your own? IMO, a...
  16. Replies
    5
    Views
    1,580

    Since /* ... */ are C-style comment, you should...

    Since /* ... */ are C-style comment, you should be using the C++ style // comments for your code.

    Then when you want to comment out a section, the /* ... */ style will work much better.
  17. Replies
    28
    Views
    3,980

    Why? You don't learn anything about doing the...

    Why? You don't learn anything about doing the conversions that way.
  18. Thread: Help with Loops

    by WaltP
    Replies
    5
    Views
    1,099

    Why not? If it doesn't tell you why they don't...

    Why not? If it doesn't tell you why they don't compile, use something that will give you a list of errors. Like a real compiler.
  19. Replies
    28
    Views
    3,980

    But '2' = 50 and '7' = 55. Why wouldn't it be...

    But '2' = 50 and '7' = 55. Why wouldn't it be 105?

    If '2' = 50, what do you have to do to actually make it 2?


    That's not a bad way to go...
  20. Replies
    28
    Views
    3,980

    Look at this chart (http://www.asciitable.com/)...

    Look at this chart and you should be able to see how the math works.
  21. Thread: reading a file

    by WaltP
    Replies
    11
    Views
    1,045

    Or you could simply close and open the file again...

    Or you could simply close and open the file again after the first read is through.
  22. Replies
    10
    Views
    2,006

    Or my personal preference: if (x >= 0) { ...

    Or my personal preference:


    if (x >= 0)
    {
    x = x + 1;
    }
    else
    {
    if ( x >= 1)
  23. Replies
    5
    Views
    1,586

    Most (all?) forums give you a finite time to make...

    Most (all?) forums give you a finite time to make changes. If you modify something after 6 replies, it makes all the replies look stupid.


    So it's in plain text. That's what we expect. That's how...
  24. Replies
    6
    Views
    2,462

    I don't think...

    I don't think size=sizeof(words)/sizeof(words[0]); is doing what you want.

    When you add an entry, simply count it.
    This count tells you exactly how many entries you have at all times. New entry,...
  25. Thread: Borland debugger

    by WaltP
    Replies
    4
    Views
    2,739

    I got mine free with the download of 5.5...

    I got mine free with the download of 5.5.
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4