CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: AmadeusAD

Page 1 of 3 1 2 3

Search: Search took 0.11 seconds.

  1. Replies
    8
    Views
    2,497

    Re: Modular Arithmetic

    What exactly do you implement? Modular arithmetic covers a lot... Anything, somehow related to remainders and integer division...
    The signature (x op y) (mod N) means, in terms of C++, that ((x % N)...
  2. Replies
    3
    Views
    2,806

    Re: Display Chinese Characters in c++

    Just a few tips:
    1) You have to use properly adjusted console to display Chinese. I.e., the corresponding fonts must be installed and displayed codepage should be also correct.
    2) You have to...
  3. Replies
    21
    Views
    2,305

    Re: Prime Numbers Help?

    Furthermore, you can replace ++i in both loops with i+=2 with some slight check adding outside the loop.
  4. Replies
    21
    Views
    2,305

    Re: Prime Numbers Help?

    Not surprisingly that no numbers are displayed. Look at your condition - it is always false since i%n cannot be both i and 1 at the same time. Why do you still code that annoying i%n==1 check? What...
  5. Re: cant see what certain part of this code does..

    Hooooppssss... Just at a glance - this is not your code and it is, by the way, ill-formed C++ style mixed with C... All those questions you ask can, I suppose, find their answers in the low-level...
  6. Replies
    21
    Views
    2,305

    Re: Prime Numbers Help?

    Again, i % n == 1 is a check whether i is divided by n with remainder 1. That is not probably what you want. If you want to check whether i has a divider different from i and 1, then you should (in...
  7. Re: std::vector's push_back() segfaults - very weird

    In my original working code, I have the vector resized after reserve(), so all the elements before push_back() exist.
    About small compilable program - you know, I reproduced the same (I think so)...
  8. Replies
    21
    Views
    2,305

    Re: Prime Numbers Help?

    You have also ill-formed logic for your task. Consider, that % operator returns the remainder, not the bool value 'divisable'. For determining whether i is divided by j, you have to determine whether...
  9. std::vector's push_back() segfaults - very weird

    Hi All,

    I have been persuaded for a long time that stl containers are the better choice compared to any home-cooked alternatives, partially, because experienced that in my own practice.
    One...
  10. Replies
    4
    Views
    619

    Re: Multi-character characters?

    Why don't you try to experiment yourself writing something like


    #include <stdio.h>

    int main()
    {
    char t = '10'; // compiler probably will warn you, but compilation will not fail
    ...
  11. Replies
    12
    Views
    1,025

    Re: Cleaner if statement

    And, by the way, your conditions will always be false due to incorrect usage of logical operation 'AND' (&&). You should use 'OR' (||) instead, since word[START] cannot be both, for instance, 'A' and...
  12. Replies
    12
    Views
    1,025

    Re: Cleaner if statement

    int i =3;
    if (word[START] == 'a' && word[START] == 'e' && word[START] == 'i'
    && word[START] == 'o' && word[START] == 'u')
    int i = 1;
    else if(word [START] =='q' && word[START + 1] == 'u')
    ...
  13. Thread: #defines

    by AmadeusAD
    Replies
    25
    Views
    2,477

    Re: #defines

    Maybe, your static library is compiled without _DEBUG defined? Try to recompile all the stuff of your project making sure _DEBUG is defined for each file. You can reach this by doing -D_DEBUG command...
  14. Replies
    13
    Views
    1,266

    Re: Overloading based on l-value or r-value

    You cannot overload function just adding one or more 'const' specifiers anywhere.
    You can use just one int& f1() for both purposes I believe.
  15. Replies
    9
    Views
    967

    Re: why i get these errors..

    I suppose scanf format string is not intended to be used as a regular expression, while in your example you do mix original format string specifiers with regexp literals. Are you sure "[^ ]" would...
  16. Replies
    9
    Views
    650

    Re: New

    Discovered the above message after posting my one and page refresh:).
  17. Replies
    9
    Views
    650

    Re: New

    endl declared inside std namespace. So, you should write


    using namespace std;

    int main()
    {
    ...
    }
  18. Re: I can't figure this out, can someone help me 'char' issues

    Also you may use switch to avoid multiplying the if-else tree (that is probably significant for a large number of various discrete variants):


    switch(gender)
    {
    case 'M':
    {
    // ... do...
  19. Replies
    6
    Views
    628

    Re: Fundamental question

    Oh, yeah, I saw this approach somewhere - good tricks for C-lovers:) and in general - useful for those who want to understand language constructs better.
    But you see, that's a kind of tricking,...
  20. Replies
    5
    Views
    600

    Re: Seg fault error

    At a first glance the following code runs into eyes:

    The arguments to scanf() functions that follow the format string specification are addresses of the vars where the input should be stored. In...
  21. Replies
    1
    Views
    431

    Re: Need help with bit algorithm!

    The idea probably is the same, just use appropriate string conversion function and/or format specifications, which recognizes hexadecimal letter-digits. No more info can be provided until you show us...
  22. Replies
    6
    Views
    628

    Re: Fundamental question

    Lindley gave complete answer. I'll just focus on conceptual difference - it's based upon the difference between those two languages. C and C++ are structural and object-oriented ones respectively....
  23. Re: BASH: read from end of file upwards

    That was Russian, you are right:)
    The question asks whether one can post in Russian on this forum. Nevermind;)
  24. Re: BASH: read from end of file upwards

    Sorry, I posted that occasionally, just for fun:)

    Actually, I like the process of spending hours solving a problem too, that brings a lot to one's qualification. And was trying to construct...
  25. Re: BASH: read from end of file upwards

    А на этом форуме пишут по-русски?)
Results 1 to 25 of 64
Page 1 of 3 1 2 3





Click Here to Expand Forum to Full Width

Featured