Commit 7f7a6850 by trkall

hgfh

parent 2d4f475a
12.87 14.78
-45.78 48.14
-87.41 28.47
42.41 -9.47
-1.78 -4.78
17.11 -41.72
-88.11 58.41
42.41 9.26
5.88 4.18
-14.21 44.12
42.87 11.38
-65.78 43.13
-17.41 24.97
44.41 -21.47
-41.78 -55.98
17.11 -1.72
-18.11 8.41
43.41 1.26
6.78 2.18
-13.21 42.12
...@@ -5,6 +5,10 @@ typedef struct{ ...@@ -5,6 +5,10 @@ typedef struct{
int loc; int loc;
}X; }X;
typedef struct{
char date[9];
}dates;
int FileLenght(FILE *sisse) int FileLenght(FILE *sisse)
{ {
int lines = 0; int lines = 0;
...@@ -16,7 +20,7 @@ int FileLenght(FILE *sisse) ...@@ -16,7 +20,7 @@ int FileLenght(FILE *sisse)
return lines; return lines;
} }
void FileSisse(dates DaraArray[], FILE *sisse) void FileSisse(dates DateArray[], FILE *sisse)
{ {
int i = 0; int i = 0;
rewind(sisse); rewind(sisse);
...@@ -56,14 +60,14 @@ void ChkDate(dates DateArray[], int lines) ...@@ -56,14 +60,14 @@ void ChkDate(dates DateArray[], int lines)
for(i=0;i<lines;i++) for(i=0;i<lines;i++)
{ {
aasta=(DateArray[i].date[0]*1000 - '0')+(DateArray[i].date[1]*100 - '0') aasta=(DateArray[i].date[4]- '0')*1000 +(DateArray[i].date[5] - '0')*100
+ (DateArray[i].date[2]*10 - '0') + (DateArray[i].date[3] - '0'); + (DateArray[i].date[6] - '0')*10 + (DateArray[i].date[7] - '0');
if(arv > 0 && arv <= 3600) if(aasta > 0 && aasta <= 3600)
{ {
kuu =(DateArray[i].date[4]*10 - '0') + (DateArray[i].date[5] - '0'); kuu =(DateArray[i].date[2]*10 - '0') + (DateArray[i].date[3] - '0');
if(kuu > 0 && kuu <= 12) if(kuu > 0 && kuu <= 12)
{ {
p2ev=(DateArray[i].date[6]*10 -'0')+(DateArray[i].date[7] -'0'); p2ev=(DateArray[i].date[0]*10 -'0')+(DateArray[i].date[1] -'0');
if(aasta%4 == 0) if(aasta%4 == 0)
{ {
liig = 1; liig = 1;
...@@ -79,20 +83,81 @@ void ChkDate(dates DateArray[], int lines) ...@@ -79,20 +83,81 @@ void ChkDate(dates DateArray[], int lines)
if(kuu == 1 || kuu == 3 || kuu == 5 || kuu == 7 || kuu == 8 || if(kuu == 1 || kuu == 3 || kuu == 5 || kuu == 7 || kuu == 8 ||
kuu == 10 || kuu == 12) kuu == 10 || kuu == 12)
{ {
if(p2ev > 0 && p2ev < 31) if(p2ev > 0 && p2ev <= 31)
{
printf("homo");
fprintf(EU, "%s EU Okey\n", DateArray[i].date);
}
}else if(kuu == 2){
if(liig == 1)
{
if(p2ev > 0 && p2ev <= 29)
{
fprintf(EU, "%s EU Okey\n", DateArray[i].date);
}
} else{
if(p2ev > 0 && p2ev <= 28)
{
fprintf(EU, "%s EU Okey\n", DateArray[i].date);
}
}
} else
{
if(p2ev > 0 && p2ev <= 30)
{ {
fprintf(EU, "%s EU Okey\n", DateArray[i].date); fprintf(EU, "%s EU Okey\n", DateArray[i].date);
} }
}
// end of EU, start of US
///----------------------------------------
kuu =(DateArray[i].date[0]*10 - '0') + (DateArray[i].date[1] - '0');
if(kuu > 0 && kuu <= 12)
{
p2ev=(DateArray[i].date[2]*10 -'0')+(DateArray[i].date[3] -'0');
if(aasta%4 == 0)
{
liig = 1;
if(aasta%100 == 0)
{
if(aasta%4 != 0)
{
liig = 0;
}
}
}
}
if(kuu == 1 || kuu == 3 || kuu == 5 || kuu == 7 || kuu == 8 ||
kuu == 10 || kuu == 12)
{
if(p2ev > 0 && p2ev <= 31)
{
fprintf(US, "%s US Okey\n", DateArray[i].date);
}
}else if(kuu == 2){ }else if(kuu == 2){
if(liig == 1) if(liig == 1)
{ {
if(p2ev > 0 && p2ev < 29) if(p2ev > 0 && p2ev <= 29)
{ {
fprintf(EU, "%s EU Okey\n") /// SIIIIINNN fprintf(US, "%s US Okey\n", DateArray[i].date);
} }
} else{
if(p2ev > 0 && p2ev <= 28)
{
fprintf(US, "%s US Okey\n", DateArray[i].date);
} }
} }
} else
{
if(p2ev > 0 && p2ev <= 30)
{
fprintf(US, "%s US Okey\n", DateArray[i].date);
}
}
///----------------------------------------
} }
} }
......
...@@ -3,13 +3,6 @@ ...@@ -3,13 +3,6 @@
#include "functions.c" #include "functions.c"
#include "useful.c" #include "useful.c"
typedef struct{
char date[9];
}dates;
int FileLenght(FILE *sisse);
void FileSisse(dates DateArray[], FILE *sisse);
int main() int main()
{ {
char *iFileName = "kuup2evad.txt"; char *iFileName = "kuup2evad.txt";
...@@ -28,6 +21,8 @@ int main() ...@@ -28,6 +21,8 @@ int main()
FileSisse(DateArray, sisse); FileSisse(DateArray, sisse);
fclose(sisse); fclose(sisse);
ChangeFormat(DateArray, lines); ChangeFormat(DateArray, lines);
ChkDate(DateArray, lines);
return 0; return 0;
} }
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment