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

Search:

Type: Posts; User: Peter_B

Page 1 of 25 1 2 3 4

Search: Search took 0.03 seconds.

  1. Replies
    7
    Views
    8

    Re: Binary file-question!!!

    int main()
    {
    int il;
    FILE *fp;
    fp=fopen("sx.txt","rb");
    if (fp==NULL){
    printf("Problem!!!\n");
    exit(0);
    }
    fseek(fp,4,0);
  2. Replies
    7
    Views
    8

    Re: Binary file-question!!!

    Depends upon how it should work :). Either:
    1) Change the code to read the file as plain-text, or
    2) Change the file so the data is binary-coded.
  3. Replies
    7
    Views
    8

    Re: Binary file-question!!!

    Your file is in plain-text format but you are reading it as if it is a binary-coded format. That's why you get what looks to be junk.
  4. Replies
    6
    Views
    341

    Re: Currently active users

    Recently, whenever I have looked at the 'Who's Online' page I get the same effect. But the split is always at the same user.
    I.e. the first page is everyone upto (and including) lfuser.
    The second...
  5. Replies
    8
    Views
    1,134

    Re: Finding if a Palindrom - Please review

    Remember to always check the code works for corner cases. For example, what will this code do for a zero-length string? Hint: it will try to access an invalid index.
  6. Re: Binary Tree Post-Order Traversal Issue

    Yes, I thought this was probably what was wrong.
    Symus, when you originally coded postorder did you copy and paste preorder and just move the cout line?
  7. Re: Binary Tree Post-Order Traversal Issue

    You must have made a mistake somewhere - it works fine for me. NB: when I said exactly as preorder, except... I meant the same structure. I.e. the postorder method would call the postorder method for...
  8. Re: Binary Tree Post-Order Traversal Issue

    Why are your preorder and postorder methods structured differently? You could have written postorder exactly as preorder, except with the 'cout << data' part at the end. There is no need for it to...
  9. Replies
    3
    Views
    416

    Re: what``s the algo?

    Here's a hint - look at all the entries where the result (number on the right) changes from the previous line.
  10. Replies
    263
    Views
    12,932

    Re: New Forum Update

    Exactly this happened to me also, and it was my post :(
    I was starting to think the upgrade had become self-aware and was removing any posts containing suggestions to remove it. :D
  11. Replies
    263
    Views
    12,932

    Re: New Forum Update

    This has probably been said before, but why can't the 'upgrade' be rolled back? It has caused many problems, with there still (after 6 months!) being no end in sight.

    I know it would be...
  12. Replies
    67
    Views
    31,914

    Re: Fun C++ Problem

    The original code has a space character where the minus sign now is - so it is replacing the space.
  13. Thread: need help

    by Peter_B
    Replies
    2
    Views
    573

    Re: need help

    Whoever wrote the specifications for this was a bit sloppy. Simply returning 'true' for any input would fulfil this requirement :D
  14. Replies
    8
    Views
    3,093

    Re: Write a C++ program to compute Sin(x)

    Rule 1: Always read the problem statement carefully. As you said in your first post:


    See the bits in red? You are only asking for x, not n
  15. Replies
    43
    Views
    3,275

    Re: [RESOLVED] Help with math algorithm

    Indeed, you do get the same results. I should have read more carefully - apologies for that.



    I wasn't thinking of this problem in terms of any of the complications you mention here, e.g....
  16. Replies
    43
    Views
    3,275

    Re: [RESOLVED] Help with math algorithm

    Of course, depending upon the distance of the person from the river bank and the oncoming water, escape may not be possible. But the strategy of running at a slight angle (in this case) towards the...
  17. Replies
    23
    Views
    1,418

    Re: Which container to do what I need?

    No, the difference is that in structs the members are public by default but for classes the members are private by default. I.e. in this case:

    struct SomeStruct
    {
    int x;
    int y;
    int z;...
  18. Replies
    4
    Views
    490

    Re: Object method does not respond

    This code is a bit odd:
    string2::string2(char ch, int n)
    {
    int ii;
    for(int i=0;i<n;i++)
    {
    str[i] = ch;
    ii = i;
    }
    str[ii] = '\0';
  19. Replies
    9
    Views
    744

    Re: Problem With DrawLine Function

    Looking at the image you provided, it is clear that the way you are drawing the filled triangles is by drawing a lot of lines radiating from one of the triangle corners. This is not a good way to...
  20. Re: trying to solve a NullReference not handled error(array trouble)

    A string is effectively a char array, so you need a string for your DNA sequence.

    In your code:
    namespace bioinformaticsCal
    {

    public partial class Form1 : Form
    {
    int...
  21. Replies
    6
    Views
    776

    Re: Summing up digits in an integer

    For any number (expressed in base 10), if the number is divisible by 3 then so is the sum of the digits - and vice versa. So you could simply determine whether the number itself is divisible by 3.
  22. Replies
    3
    Views
    543

    Re: Help looking over

    (Irrelevant code deleted)

    What happens if you choose option 1) and only have 1 hour usage? :)
  23. Replies
    14
    Views
    1,233

    Re: [RESOLVED] Astrological Calculations

    I explained this in my first post - it is because Capricorn spans dates from the end of one year into the start of the next. Therefore the 'start' date (23rd December) is later in the year than the...
  24. Replies
    14
    Views
    1,233

    Re: [RESOLVED] Astrological Calculations

    Looks OK to me. What value of strAux does it not work for?

    Edit: Are you sure that strAux has the leading zeroes correctly? I.e. is the first of january "0101" rather than "11"?
  25. Replies
    14
    Views
    1,233

    Re: Astrological Calculations

    This pattern works (assuming that the leading zeroes are always present in Text5 and Text7) for all except 'Capricorn', as the dates for that span the end of the year.
    Following the pattern would...
Results 1 to 25 of 601
Page 1 of 25 1 2 3 4



HTML5 Development Center

Click Here to Expand Forum to Full Width