Как сделать сортировку по алфавиту через strcmp?
#include
#include
#include
#include
struct firm
{char name[20];
float cost;
int period;
int tax;
};
int main()
{
int n, i=0;
firm *company,change;
printf("Enter the number of services: ");
scanf("%d", &n);
company = new firm[n];
for (int i=0; i
printf("Enter cost of service: \n");
scanf("%f", &company.cost);
printf("Enter tax: \n");
scanf("%d", &company.tax);
printf("Enter period of work: \n");
scanf("%d", &company.period);
system("cls");
}
ЗДЕСЬ НУЖНА СОРТИРОВКА
printf("Service name: Cost of service: Tax: Period of work: \n");
for (int i=0; i
printf("%-19.2f", company.cost);
printf("%-7d", company.tax);
printf("%-d", company.period);
printf("\n");
}
getch();
}