Народ помогите пожалуйста сделать или исправить программу необходимую мне для сдачи экзамена... а то преподу сдают одни и теже и он нифига ставить не хочет...
Задание:

Написать программу обрабатывающую листинг программы на языке С++ с целью формирования файла, описывающего управляющую структуру входной программы на языке GDL.

Мой листинг:

//---------------------------------------------------------------------------

#pragma hdrstop
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
#include <string.h>
#pragma argsused


int main(int argc, char* argv[])
{
cout <<"GDL file is creating...";
char *str1=" node: { title:";
char str11='"';
char str12='}';
char *str13="main";
char *str2 = " label: ";
char *str3 = " color: 76 textcolor: 73 bordercolor: black }\n";
char *str4 = "edge: { sourcename: ";
char *str5 = " targetname: ";
FILE *input,*pal,*output, *matrica;
input = fopen("Unit.cpp","r+");
pal = fopen("pal.txt","r+");
output = fopen("output.gdl","w+");
matrica = fopen("Matrica.cpp","r+");
char ch[100],chp[100000];
char met[100];
char metka[100];
int h,i,n,j,l,k,poz,hod,len,str;
n=0;
k=1;
hod=0;
i=0;
j=0;
h=0;
str=0;



while (!feof(pal))
{
chp[h]=fgetc(pal);
h=h+1;
}
len=strlen(chp);


for (l=0;l<(len-2);l++)
{
fputc(chp[l],output);
}
fprintf(output,"%s %c %d %c %s %c %s %c %s ",str1,str11,0,str11,str2,str11,str13,str11,str3);



while (!feof(input))
{
ch[n]=fgetc(input);
n=n+1;
}



while (i<(n-1))
{
fprintf(output,"%s %c %d %c %s %c",str1,str11,k,str11,str2,str11);
while (ch[i] != ';')
{
fprintf(output,"%c",ch[i]);
i=i+1;
}
fprintf(output,"%c %s",str11,str3);
i=i+1;
k=k+1;
}

while (!feof(matrica))
{

metka[i]=fgetc(matrica);
i=i+1;
}
for (j=0;j<i;j++)
{
if ((metka[j]!=' ')&& (metka[j] !='\0')&&(metka[j] !='я')&&(metka[j] !='\n')&&(metka[j+1]!=' ')&& (metka[j+1] !='\0')&&(metka[j+1] !='я')&&(metka[j+1] !='\n'))
{

fprintf(output,"%s %c %d %c %s %c %c %c %c \n",str4,str11,metka[j]-48,str11,str5,str11,metka[j+1],str11,str12);

}

}



fprintf(output,"%c",str12);
getch();
return 0;
}
//---------------------------------------------------------------------------



Препод говорит о том что надо чтобы матрица формировалась автоматически а не вручную.... и вроде еще по поводу формирования автоматически классов.... Кому не влом еще и алгоритм бы не помешал...

С ув. Axel