search(tv, goroda, k, &kg); //поиск городов
//вывод результата на экран и в файл
fout=fopen("result.txt", "w");
printf("Result:\n%d cities with the lowest price of the TV:\n", kg);
fprintf(fout, "Result:\n%d cities with the lowest price of the TV:\n",kg);
for (i=0; i<kg; i++)
{
puts(goroda[i]);
fprintf(fout, "%s\n", goroda[i]);
}
fclose(fout);
puts("Results saved in file: \"result.txt\"");
return 0;
}