#include <stdio.h>
#include <conio.h>
#include <windows.h>
#include <math.h>
#define DBL_EPSILON 2.2204460492503131e-16
int main(int argc, char const *argv[])
{
int degree;
double *poly, term;
printf("Enter degree of polynomial (1-10):", i);
scanf("%d", °ree);
// calloc заполняет выделяемую облать нулями
poly = calloc(degree+2, sizeof(double));
for (int i = degree; i >= 0; i--) {
printf("Enter x^%d term:", i);
scanf("%f", &term);
poly[degree+2] += term;
poly[degree] -= term/2;
}
printf("Result: ");
for (int i = degree+2; i >= 0; i--) {
// Выводим только ненулевые члены
if (abs(poly[i]) > DBL_EPSILON) {
// Добавляем плюс для положительных коэффициентов
if (poly[i] > 0) {
printf("+");
}
printf("%.4G", poly[i]);
// Выводим только ненулевые степени
if (i > 0) {
printf("*x^%d", i);
}
}
}
printf("\n");
// Прибраться за собой - хороший тон
free(poly);
getch();
return 0;
}
http://my.site/Почти все символы "$%&'()*+,.:;<=>@[\]^_`{|}~/
в человеко-читаемом представлении может использоваться любой символ
http://www.my own ste.com/
http://www.my+own+site.com/
http-URI = "http://" authority path-abempty [ "?" query ] [ "#" fragment ]
https-URI = "https://" authority path-abempty [ "?" query ] [ "#" fragment ]
path-abempty = *( "/" segment )
segment = *pchar
pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
pct-encoded = "%" HEXDIG HEXDIG
sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
/ "*" / "+" / "," / ";" / "="
/ : @ - . _ ~ % ! $ & ' ( ) * + , ; =