I have just started learning svd in C at the university, and I have this task due tonight, but I can't make this work. In theory, the only problem is that the svd file generates, but stays empty. I have done a lot of changes since the first try and the warnings have disappeared over time, and it generates a file, but still not write it. Can somebody please help me get this work fine?
The code:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(){
int ora, perc, mp;
//Beolvas
printf("Add meg az idot ora perc mp formatumban: ");
scanf("%d %d %d", &ora, &perc, &mp);
ora=ora%12;
//számolás (mp->rad)
double fokora, fokperc, fokmp;
fokmp=((((double)mp/60))*360-90)*(M_PI/180);
fokperc= ((((double)(mp+perc*60))/3600)*360-90)*(M_PI/180);
fokora= ((((double)(mp+perc*60+ora*3600))/43200)*360-90)*(M_PI/180);
//Mutatók koordináltája
double oraX, oraY, percX, percY, mpX, mpY;
oraX=60*cos(fokora);
oraY=60*sin(fokora);
percX=75*cos(fokperc);
percY=75*sin(fokperc);
mpX=70*cos(fokmp);
mpY=70*sin(fokmp);
//rajz
//mutatok(0, 0, oraX, oraY);
//mutatok(0, 0, percX, percY);
//mutatok(0, 0, mpX, mpY);
FILE*fptr;
//fprintf("fptr,<svg>", "w");
fptr = (fopen("file:///C:/Users/madia/%C3%B3ra.svg", "w"));
fprintf(fptr,"<svg width=\"200\" height=\"200\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">");
fprintf(fptr,"<circle cx=\"0\" cy=\"0\" r=\"100\" stroke=\"black\" fill=\"blue\" />");
fprintf(fptr,"<line x1=\"%d\" y1=\"%d\" x2=\"%f\" y2=\"%f\" stroke=\"black \"/>",0, 0, oraX, oraY);
fprintf(fptr,"<line x1=\"%d\" y1=\"%d\" x2=\"%f\" y2=\"%f\" stroke=\"black\"/>",0, 0, percX, percY);
fprintf(fptr,"<line x1=\"%d\" y1=\"%d\" x2=\"%f\" y2=\"%f\" stroke=\"black\"/>",0, 0, mpX, mpY);
int x=0;
double beosztasX1, beosztasY1, beosztasX2, beosztasY2;
while (x>60){
if (x % 5==0){
//orá beosztás
beosztasX1= 90*cos(6*x);
beosztasY1= 90*sin(6*x);
beosztasX2= 100*cos(6*x);
beosztasY2= 100*sin(6*x);
}else{
//perc beosztás
beosztasX1= 95*cos(6*x);
beosztasY1= 95*sin(6*x);
beosztasX2= 100*cos(6*x);
beosztasY2= 100*sin(6*x);
}
double beosztasok(double x1, double y1, double x2, double y2){
beosztasok(beosztasX1, beosztasX2, beosztasY1, beosztasY2);
fprintf(fptr,"<line x1=\"%f\" y1=\"%f\" x2=\"%f\" y2=\"%f\" stroke=\"black\"/>", beosztasX1, beosztasX2, beosztasY1, beosztasY2);
x+=1;
}
}
fprintf(fptr,"<\svg>");
return 0;
}
