ПОЛИНОМ

#include "stdafx.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <conio.h> const int MAX = 100; char poly[100], monom[10]; /* int analys(char a[MAX]) { int ANSW, i; char coef_c; for (i = 0; i < strlen(a); i++) { if (a[i] == 'x' && (a[i + 1] == '-' || a[i + 1] == '+')) ANSW = 1; } }*/ void mon(char poly[]) { char aux_mon[100], aux_pol[100]; int i, len; len = 1; while ((poly[len]!='-') || (poly[len] != '+')); { len++; } strncpy(aux_mon, poly, len); for (i = len+1; i < strlen(poly); i++) { aux_pol[i - (len + 1)] = poly[i]; } for (i = 1; i < strlen(poly); i++) { poly[i] = NULL; } strcpy(poly, aux_pol); } void main() { int len, i; char a[MAX], b[MAX] = "+"; len = strlen(a); scanf("%s", &a); if (a[0] != '+') { strcat(b, a); } else for (i = 0; i < len; i++) b[i] = a[i]; puts(b); getch(); } /* strncpy(m3, m1, 6); // не добавляет '\0' в конце строки strcpy(m3, m1); strncat(m3, m2, 5); strcat(m3, m2); strnset(m3, 'f', 7); strset(m3, 'k'); */

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.