12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- #pragma once
- #define _CRT_SECURE_NO_WARNINGS
- #include <string.h>
- #include <stdlib.h>
- #include <stdio.h>
- #include "Header.h"
- #include <ctype.h>
- #include <math.h>
- double plus(double a, double b) {
- return a + b;
- }
- double minus(double a, double b) {
- return a - b;
- }
- double umnosh(double a, double b) {
- return a * b;
- }
- double del(double a, double b) {
- return a / b;
- }
- void concat(char* first, char* second) {
- char third[512];
- snprintf(third, sizeof third, "%s%s", first, second);
- printf(third);
- }
- void inttostr(double num, char* str) {
- int i = 0;
- int otric = 0;
- if (num < 0) {
- otric = 1;
- num = -num;
- }
- long long intPart = (long long)num;
- double fpart = num - intPart;
- if (intPart == 0) {
- str[i++] = '0';
- }
- else {
- while (intPart > 0) {
- str[i++] = (intPart % 10)+'0';
- intPart /= 10;
- }
- }
- if (otric) {
- str[i++] = '-';
- }
- for (int j = 0; j < i / 2; j++) {
- char temp = str[j];
- str[j] = str[i - j - 1];
- str[i - j - 1] = temp;
- }
- str[i++] = '.';
- for (int j = 0; j < 6; j++) {
- fpart *= 10;
- int digit = (int)fpart;
- str[i++] = digit + '0';
- fpart -= digit;
- }
- str[i] = '\0';
- }
- double strtoInt(char* str) {
- double result = 0.0;
- int sign = 1;
- double dp = 1.0;
- int i = 0;
- while (isspace(str[i])) {
- i++;
- }
- if (str[i] == '-') {
- sign = -1;
- i++;
- }
- else if (str[i] == '+') {
- i++;
- }
- while (isdigit(str[i])) {
- result = result * 10.0 + (str[i] - '0');
- i++;
- }
- if (str[i] == '.') {
- i++;
- while (isdigit(str[i])) {
- dp *= 10.0;
- result += (str[i] - '0') / dp;
- i++;
- }
- }
- return sign * result;
- }
|