Gonbe 32 Newbie Poster

One thing to look out for is integer division. the return type of fact, x and n are all integers. Try this:

#include<iostream>

using namespace std;
int fact (int no)
{
    int total;
    for (int i=0; i<=no; i++)
    {
        if(i ==0)
            total = 1;
        else
            total = total * i;
    }
    return total;
}
int main()
{
    int x,n;
    double result;
    cout<<"Please key i x value : ";
    cin>>x;
    cout<<"\n";
    cout<<"Please key in n value : ";
    cin>>n;
    if (x<n)
        cout<<"Wrong input, x valur must be greater than n !!\n"<<endl;
    else
        cout <<"\nResult = 1 +2!/"<<x-2
             <<" - 3!/"<<x-3
             <<" + 4!/"<<x-4<< " - "<<n
             <<"!/"<<x-n
             <<" = "<<1+(fact(2)/static_cast<double>(x-2))-(fact(3)/static_cast<double>(x-3))+(fact(4)/static_cast<double>(x-4))-(fact(n)/(static_cast<double>(x-n)));

    return 0;
}
Gonbe 32 Newbie Poster

An easy approach would be to determine the mean in the first pass through the file, then go through the file again to determine the standard deviation by squaring the differences of every number with the mean and then take the square root of the average of those values.

There are also algorithms which calculate the standard deviation in a single pass ("on the fly") but those are more complicated and shouldn't be that difficult to find by a simple google search.

Gonbe 32 Newbie Poster

1) you are expecting us to remember one post you made elsewhere out of hundreds we read daily

You've made the reference to a previous post in another thread yourself. In that case, yes. I do expect you to remember it.

2) sarcasm requires knowledge of the one making sarcastic remarks. All I understand is from what you posted above.

Knowledge about recent events also aid and you were present in those.

3) on a forum, a smily generally hints at sarcasm. No smily, you must be simply daft.

As someone who dislikes smileys I can tell you there's more than that. I don't see writers using smileys in their books (thanks god) and they seem to get their intent across just fine.

The combination of the first two lines ending with '!' and the statement following it which you even quotes should be way obvious. If you're incapable of detecting it then I consider it your issue. But sure, I can omit sarcasm from my posts from now on. Posting a sneer trying to ridicule a post while you are in fact the one not understanding the post at all has the opposite desired effect for you, though. I guess I'll view it as karma.

4) whether you agree or not, you are not to post working answers. Period.

The community rules don't seem to mention this. I'll determine on a per-post basis how I could help a user best, thanks.

WaltP commented: If you have a problem with the way things are supposed to be done, keep it out of the responses and make your points in the Feedback Forum. Stop cluttering up other people's threads with your rants. -3
Gonbe 32 Newbie Poster

and making himself look... well... you know... he just didn't delete the explanation himself and not post it.

Sarcasm. Do.. you.. understand.. it?

Appearently you fail to grasp anything so I make it clear: In case it wasn't obvious in the other thread I don't agree with not posting solutions so this was formulated in that specific way as a slight ridicule towards it.

Feel free to private message me in case you're ever having troubles reading.

Gonbe 32 Newbie Poster
    char *p1="Name";                // Non-const pointer pointing to non-const char.
    const char *p2="Name";          // Non-const pointer pointing to constant char.
    char const *p3="Name";          // Alternative syntax for p2.
    char *const p4="Name";          // Const pointer pointing to non-const char.
    const char *const p5="Name";    // Const pointer pointing to const char.

    ++p1;   // Fine:  p1 isn't a const pointer.
    ++*p1;  // Fine:  p1 points to chars who aren't const.
    ++p2;   // Fine:  p2 isn't a const pointer.
    ++*p2;  // Error: p2 points to a const char and you're trying to increment it here.
    ++p3;   // Fine:  p3 isn't a const pointer. (p2 and p3 are basically declared the same way but in a different syntax)
    ++*p3;  // Error: p3 points to a const char and you're trying to increment it here.
    ++p4;   // Error: p4 points to non-const data, but you're trying to modify the pointer itself here, which is const.
    ++*p4;  // Fine:  p4 itself is const but the data is points to is non-const. Dereferencing and then incrementing is fine as a result.
    ++p5;   // Error: p5 is a const pointer as well as it pointing to const data.
    ++*p5;  // Error: p5 is a const pointer as well as it pointing to const data.

Added some comments with each statement that should answer your question.

Uhm, I mean, here's a hint! It has to do with asteriks and the position of the const keyword! More precisely you should look up the difference between "const char" and "char

Gonbe 32 Newbie Poster

What you are doing now is trying to use a functor. (overloaded () operator for that object)

Use the initialization section of the constructor to initilize the object:

Desktop::Desktop() : otwarte_okna()
{
    x1=y1=0;
    x2=y2=1000000;
}
Gonbe 32 Newbie Poster

I'm not sure if I understand your question correctly, but you could just copy the data like you would with non-allocated data. So something like this is what I mean:

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

#define AMOUNT_OF_DATA 20

int main (int argc, char *argv[])
{
    int *allocatedData = (int*) malloc(AMOUNT_OF_DATA * sizeof(int));
    int i = 0;

    //putting data in the allocated memory:
    for (i = 0; i < AMOUNT_OF_DATA; i++)
        allocatedData[i] = i + 1;

    printf("Contents of allocatedData:\n");
    for (i = 0; i < AMOUNT_OF_DATA; i++)
        printf("%d ", allocatedData[i]);

    //Make a copy
    int dataCopy[AMOUNT_OF_DATA];

    //Copy the data from the allocated memory to the new variable.
    for (i = 0; i < AMOUNT_OF_DATA; i++)
        dataCopy[i] = allocatedData[i];

    //Freeing the allocated memory
    free(allocatedData);

    //Showing contents of the copy
    printf("\n\nContents of dataCopy:\n");
    for (i = 0; i < AMOUNT_OF_DATA; i++)
        printf("%d ", dataCopy[i]);

    return 0;
}

Will result in the following output:

Contents of allocatedData:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

Contents of dataCopy:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20