Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 975

 
Question for C experts - how to fix the code below
(no matter what number I put in when running the executable, I always get '2'):

#include <stdio.h>
 
int main (int k) {
    printf("number %d \n", k);
 
    return 0;
}
 
atztek:
Question for C experts - how to fix the code below
(no matter what number I put in when I run the executable, I always get '2'):


To accept command line arguments, two special built-in arguments are used: argc and argv. The argc parameter contains the number of arguments on the command line and is an integer, always at least 1 because the first argument is assumed to be the program name. The argv parameter is a pointer to an array of string pointers. In this array, each element points to some command line argument. All command line arguments are string, so conversion of any numbers to a desired binary format must be provided in the program during development.

PS: From here

 
PozitiF:

Two special built-in arguments are used to accept command line arguments: argc and argv. The argc parameter contains the number of arguments on the command line and is an integer, always at least 1 because the first argument is the program name. The argv parameter is a pointer to an array of string pointers. In this array, each element points to some command line argument. All command line arguments are string, so any conversion to binary must be planned into the program during development.

PS: from here

Thanks, got it.
Not sure about the names of the arguments (in the sense that there could be others), but that's really the idea.
 

This is a question related to C programming, but in this case of a general nature.
The program needs to run for say 500 hours, after which it should stop running automatically.
How to do the check correctly so that it loads the processor as little as possible?

As far as I remember, we need a loop (while/for) inside which the current time will be checked and then compared to the time of termination. When it is reached, the work will stop. Is this correct or am I missing something?

 
atztek:

I have a question related to C programming, but in this case it's general in nature.
The program needs to run for say 500 hours, after which its execution should stop automatically.
How to carry out the check correctly so that to load the processor as less as possible?

As far as I remember, we need a loop (while/for) inside which the current time will be checked and then compared to the time of termination. When it is reached, the work will stop. Is this correct or am I missing something?

WinAPI has a timer https://msdn.microsoft.com/ru-ru/library/windows/desktop/ms644906%28v=vs.85%29.aspx


Usageexamples.

 
For WinAPI Thanks! And in the general, simpler case, what I have described (at idea level) looks right or not?
 
Hello dear!

Please help translate the algorithm for finding the coordinates of the intersection point of two segments

From the article:

It's very simple!
x1,y1 and x2,y2 are coordinates of vertices of the first segment;
x3,y3 and x4,y4 are coordinates of the vertices of the second segment;

to find the intersection we make the equations of the lines:
first equation:
(x-x1)/(x2-x1)=(y-y1)/(y2-y1);
second equation
(x-x3)/(x4-x3)=(y-y3)/(y4-y3);
these equations define a line passing through two points, which is what we need.
From these equations we find x and y by the following formulas:
x:=((x1*y2-x2*y1)*(x4-x3)-(x3*y4-x4*y3)*(x2-x1))/((y1-y2)*(x4-x3)-(y3-y4)*(x2-x1));
y:=((y3-y4)*x-(x3*y4-x4*y3))/(x4-x3);
since our lines intersect, they have a common intersection point with the coordinates (x,y), which we need to find.
For the intersection to belong to our line segments, we need to constrain it, i.e. check the condition:
if
(((x1<=x)and(x2>=x)and(x3<=x)and(x4 >=x))or((y1<=y)and(y2>=y)and(y3<=y) and(y4>=y))
then there is an intersection point of these segments, and if there is not, there is no intersection point.
You should also check the parallelism of these segments using angle coefficients:
k1:=(x2-x1)/(y2-y1);
k2:=(x4-x3)/(y4-y3);
where k1 and k2 are the tangents of the angle of inclination of segments to the positive direction of axis ОХ, if k1=k2, then the segments are parallel, so they have no points of intersection.

Готовая функция.
Код:

POINT Point_X(POINT a1,POINT a2,POINT a3,POINT a4){
        POINT T;
        if(((a1.x<=T.x)&&(a2.x>=T.x)&&(a3.x<=T.x)&&(a4.x >=T.x))||((a1.y<=T.y)&&(a2.y>=T.y)&&(a3.y<=T.y)&&(a4.y>=T.y))){
                float x1=a1.x,x2=a2.x,x3=a3.x,x4=a4.x,y1=a1.y,y2=a2.y,y3=a3.y,y4=a4.y;
                float k1,k2;
                if(y2-y1!=0){
                        k1=(x2-x1)/(y2-y1);
                        if(y4-y3!=0){
                                k2=(x4-x3)/(y4-y3);
                                if(k1!=k2){
                                        T.x=((a1.x*a2.y-a2.x*a1.y)*(a4.x-a3.x)-(a3.x*a4.y-a4.x*a3.y)*(a2.x-a1.x))/((a1.y-a2.y)*(a4.x-a3.x)-(a3.y-a4.y)*(a2.x-a1.x));
                                        T.y=((a3.y-a4.y)*T.x-(a3.x*a4.y-a4.x*a3.y))/(a4.x-a3.x);
                                        T.x*=-1;
                                        return T;
                                }else{
                                        T.x=969; T.y=969;
                                        //text2("Паралельны");
                                }
                        }else{
                                T.x=969; T.y=969;
                                //text2("Паралельны");
                        }
                }else{
                        T.x=969; T.y=969;
                        //text2("Паралельны");
                }
        }else{
                //text2("Пересечение вне отрезка");
                T.x=979; T.y=979;
                return T;
        }

}

Or maybe someone has a ready-made one in the archives?

 
optionany:

Greetings

Does MT4 have a feature or function) Send internal terminal mail to or sms, (e.g. to receive server restarts, etc.)?

People, does nobody know about this?
 
optionany:
Doesn't anyone know about this?
Isn't your mother allowed to read the documentation? Like SendMail.
 
AlexeyVik:
And your mother does not allow to read the documentation? For example SendMail

Yes this function of course I know, I mean - a tab in the window of the terminal, (trade, assets, account history, news, alerts, mail, etc.) when mail comes there (in the internal mail terminal) sent SMS or e-mail (eg to receive messages about server reboot, etc.)?

Reason: