Search:

Type: Posts; User: modwind

Search: Search took 0.00 seconds.

  1. Replies
    104
    Views
    13,197

    That is true, so every global data should be a...

    That is true, so every global data should be a class with functions to access its contents. The functions allow to control simultaneous access from different threads and can check data for validity...
  2. rogster001, this IS a Caeser Cipher. That task...

    rogster001, this IS a Caeser Cipher.

    That task is not hard. You should use 2 arrays of chars:
    char plaintext[26];
    char cypher[26];
    Fill the first one with A-Z.
    Start to fill the second one by...
  3. Replies
    4
    Views
    994

    Your code is too complicated. Try something like...

    Your code is too complicated. Try something like this (read one record at a time):


    fstream file("AirLine.txt", ios::in | ios::out | ios::app | ios::binary);
    file.seekg(0, ios::beg);
    ...
  4. Replies
    4
    Views
    994

    jackirl, sizeof(string) has no useful meaning. It...

    jackirl, sizeof(string) has no useful meaning. It does not show real amount of memory required to store a string in a file. And this amount is variable, equal to current number of characters in it.
  5. Thread: General Advice

    by modwind
    Replies
    3
    Views
    1,896

    int is generally a 4-byte (32 bit) value. The...

    int is generally a 4-byte (32 bit) value. The maximum number of binary digits needed to represent it is 32.
  6. Thread: Linked List

    by modwind
    Replies
    22
    Views
    2,446

    To write an STL container like std::list or even...

    To write an STL container like std::list or even std::vector, a lot of effort is needed. Not only coding and testing but developing interfaces. IMHO your main mistake is implementing some random...
  7. Thread: shorter code

    by modwind
    Replies
    10
    Views
    1,756

    Why so serious? It was just a game to make...

    Why so serious? It was just a game to make shorter code. Everyone understands it is not an example for real life. Like assembler demos 256 bytes or 64k long.
  8. Thread: shorter code

    by modwind
    Replies
    10
    Views
    1,756

    The program counts a sum of arithmetic...

    The program counts a sum of arithmetic progression starting from 1 to the input number and should stop on invalid input. There is a mistake in czarny020's code: when you enter text, it loops...
  9. Replies
    30
    Views
    7,213

    I think CatastropheNoob wants a "custom sized...

    I think CatastropheNoob wants a "custom sized array of named objects". It is easy to achieve with std::map:


    std::map<std::string,std::string> mymap;

    mymap["name1"]="an element";...
  10. Replies
    10
    Views
    25,934

    You should use conversion only when target type...

    You should use conversion only when target type can contain smaller amount of data (assignment of "short" to "char" for example).

    By position I mean that "DS0008D-0111A", "DS0080D-0111A" will give...
  11. 1. When you find the string's length, you have a...

    1. When you find the string's length, you have a mistake:


    for(j=0;s[j]!='\0';j++)
    ;
    j--;


    2. 10100 is correct binary for decimal 20.
  12. Replies
    10
    Views
    25,934

    You're using type conversions incorrectly: ...

    You're using type conversions incorrectly:

    chksum+= (unsigned short)*(start_addr+i);(unsigned short) is not needed here.

    chksum = (char)~chksum;(char) truncates your checksum from 2 bytes to 1....
  13. Replies
    4
    Views
    9,013

    Why do you want to compare characters? Probably...

    Why do you want to compare characters? Probably it would be better to create a function that converts chars to booleans, and then it is easy to use any standard operators.


    bool CharToBool(char...
  14. Thread: int overflow

    by modwind
    Replies
    9
    Views
    2,211

    To be sure that your array has valid size and you...

    To be sure that your array has valid size and you are able to iterate through it, use constants instead of defines. The preferable type is "size_t" which is unsigned integer that can fit any possible...
  15. Replies
    15
    Views
    5,836

    I get warnings from gcc when your code is...

    I get warnings from gcc when your code is compiled:


    unknown conversion type character 'L' in format
    too many arguments for format

    Seems the compiller does not support long doubles input.
    ...
Results 1 to 15 of 15