瀏覽代碼

Доделал препроцессоры

Павлов Денис Александрович 3 周之前
父節點
當前提交
fcb1a0f36b

二進制
.vs/ZagolovochnieFaily/FileContentIndex/247f35cd-86ac-4bfa-935e-a2caac18d0d5.vsidx


二進制
.vs/ZagolovochnieFaily/FileContentIndex/384d6900-ce29-4bc3-be83-4d5d6c3c3684.vsidx


二進制
.vs/ZagolovochnieFaily/FileContentIndex/77263727-a660-4c76-bbe4-d120a22f9afc.vsidx


二進制
.vs/ZagolovochnieFaily/FileContentIndex/c2e30a42-388b-40e8-93ac-95ccbdd30a36.vsidx


二進制
.vs/ZagolovochnieFaily/v17/.suo


二進制
.vs/ZagolovochnieFaily/v17/Browse.VC.db


+ 3 - 4
.vs/ZagolovochnieFaily/v17/DocumentLayout.backup.json

@@ -35,8 +35,7 @@
               "ToolTip": "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.22621.0\\ucrt\\stdio.h",
               "ViewState": "AgIAAGkCAAAAAAAAAAAiwIUCAAAAAAAAAAAAAA==",
               "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
-              "WhenOpened": "2024-10-21T05:38:17.685Z",
-              "EditorCaption": ""
+              "WhenOpened": "2024-10-21T05:38:17.685Z"
             },
             {
               "$type": "Document",
@@ -46,7 +45,7 @@
               "RelativeDocumentMoniker": "ZagolovochnieFaily\\arithmetic.h",
               "ToolTip": "D:\\Pavlov\\\u041C\u0414\u041A 01.04 \u041C\u0443\u0445\u0438\u043D\\ZagolovochnieFaily\\ZagolovochnieFaily\\arithmetic.h",
               "RelativeToolTip": "ZagolovochnieFaily\\arithmetic.h",
-              "ViewState": "AgIAABsAAAAAAAAAAAAAACkAAAAAAAAAAAAAAA==",
+              "ViewState": "AgIAAA8AAAAAAAAAAAAAAAYAAAARAAAAAAAAAA==",
               "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
               "WhenOpened": "2024-10-18T07:25:00.766Z",
               "EditorCaption": ""
@@ -59,7 +58,7 @@
               "RelativeDocumentMoniker": "ZagolovochnieFaily\\Program.c",
               "ToolTip": "D:\\Pavlov\\\u041C\u0414\u041A 01.04 \u041C\u0443\u0445\u0438\u043D\\ZagolovochnieFaily\\ZagolovochnieFaily\\Program.c*",
               "RelativeToolTip": "ZagolovochnieFaily\\Program.c*",
-              "ViewState": "AgIAAAAAAAAAAAAAAAAAAAgAAAAZAAAAAAAAAA==",
+              "ViewState": "AgIAAAAAAAAAAAAAAAAAAA4AAAAOAAAAAAAAAA==",
               "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000423|",
               "WhenOpened": "2024-10-10T11:57:51.573Z",
               "EditorCaption": ""

+ 3 - 4
.vs/ZagolovochnieFaily/v17/DocumentLayout.json

@@ -35,8 +35,7 @@
               "ToolTip": "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.22621.0\\ucrt\\stdio.h",
               "ViewState": "AgIAAGkCAAAAAAAAAAAiwIUCAAAAAAAAAAAAAA==",
               "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
-              "WhenOpened": "2024-10-21T05:38:17.685Z",
-              "EditorCaption": ""
+              "WhenOpened": "2024-10-21T05:38:17.685Z"
             },
             {
               "$type": "Document",
@@ -46,7 +45,7 @@
               "RelativeDocumentMoniker": "ZagolovochnieFaily\\arithmetic.h",
               "ToolTip": "D:\\Pavlov\\\u041C\u0414\u041A 01.04 \u041C\u0443\u0445\u0438\u043D\\ZagolovochnieFaily\\ZagolovochnieFaily\\arithmetic.h",
               "RelativeToolTip": "ZagolovochnieFaily\\arithmetic.h",
-              "ViewState": "AgIAABsAAAAAAAAAAAAAACkAAAAAAAAAAAAAAA==",
+              "ViewState": "AgIAAA8AAAAAAAAAAAAAAAYAAAARAAAAAAAAAA==",
               "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
               "WhenOpened": "2024-10-18T07:25:00.766Z",
               "EditorCaption": ""
@@ -59,7 +58,7 @@
               "RelativeDocumentMoniker": "ZagolovochnieFaily\\Program.c",
               "ToolTip": "D:\\Pavlov\\\u041C\u0414\u041A 01.04 \u041C\u0443\u0445\u0438\u043D\\ZagolovochnieFaily\\ZagolovochnieFaily\\Program.c",
               "RelativeToolTip": "ZagolovochnieFaily\\Program.c",
-              "ViewState": "AgIAAAAAAAAAAAAAAAAAABQAAABCAAAAAAAAAA==",
+              "ViewState": "AgIAAAAAAAAAAAAAAAAAABoAAAABAAAAAAAAAA==",
               "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000423|",
               "WhenOpened": "2024-10-10T11:57:51.573Z",
               "EditorCaption": ""

二進制
.vs/ZagolovochnieFaily/v17/ipch/AutoPCH/1aa652230783f010/PROGRAM.ipch


+ 62 - 0
ZagolovochnieFaily/Program.c

@@ -8,6 +8,59 @@
 #define PRECISION "%.2f"
 #define FULL_PRECISION "%.3f"
 
+#define SQUARE(x) ((x) * (x))
+//Ìàêðîñ äëÿ ðàñ÷åòà äëèíû îòðåçêà
+#define LENGTH(x1, y1,x2,y2) (sqrt(SQUARE(x2 - x1) + SQUARE(y2 - y1)))
+//äèðåêòèâû äëÿ ðåæèìà âû÷èñëåíèÿ
+#define MODE 2 // 1 - äëèíà îòðåçêà, 2 - ïðîâåðêà òðåóãîëüíèêà
+
+#if MODE == 1
+void calculate_otrezok() {
+	//Ââîä êîîðäèíàò äëÿ íàõîæäåíèÿ äëèíû îòðåçêà
+	double x1, y1, x2, y2, x3, y3;
+	printf("\nÂâåäèòå êîîðäèíàòû ïåðâîé òî÷êè: ");
+	scanf("%lf %lf", &x1, &y1);
+	printf("Ââåäèòå êîîðäèíàòû âòîðîé òî÷êè: ");
+	scanf("%lf %lf", &x2, &y2);
+	double lenght = LENGTH(x1, y1, x2, y2);
+	printf("Äëèíà îòðåçêà: %.2f\n", lenght);
+}
+
+#elif MODE == 2
+void calculate_triangle() {
+	double x1, y1, x2, y2, x3, y3;
+	printf("\nÂâåäèòå êîîðäèíàòû ïåðâîé òî÷êè: ");
+	scanf("%lf %lf", &x1, &y1);
+	printf("Ââåäèòå êîîðäèíàòû âòîðîé òî÷êè: ");
+	scanf("%lf %lf", &x2, &y2);
+	printf("Ââåäèòå êîîðäèíàòû òðåòüåé òî÷êè: ");
+	scanf("%lf %lf", &x3, &y3);
+	//Âû÷èñëåíèå äëèí ñòîðîí òðåóãîëüíèêà
+	double side1 = LENGTH(x1, y1, x2, y2);
+	double side2 = LENGTH(x2, y2, x3, y3);
+	double side3 = LENGTH(x3, y3, x1, y1);
+
+	//Ïðîâåðêà ñóùåñòâîâàâíèÿ òðåóãîëüíèêà
+	if ((side1 + side2 > side3) && (side2 + side3 > side1) && (side3 + side1 > side2)) {
+		//Ïåðèìåòð
+		double perimeter = side1 + side2 + side3;
+		printf("Òðåóãîëüíèê ñóùåñòâóåò\n");
+		printf("Ïåðèìåòð òðåóãîëüíèêà: %.2f\n", perimeter);
+
+		//Ïëîùàäü
+		double semi_perimeter = perimeter / 2;
+		double S = sqrt(semi_perimeter * (semi_perimeter - side1) * (semi_perimeter - side2) * (semi_perimeter - side3));
+		printf("Ïëîùàäü òðåóãîëüíèêà: %.2f\n", S);
+	}
+	else {
+		printf("Òðåóãîëüíèê íå ñóùåñòâóåò\n");
+	}
+}
+#else 
+void no_mode() {
+	printf("\nÍåèçâåñòíûé ðåæèì âû÷èñëåíèÿ. \n");
+}
+#endif
 int main()
 {
 	system("chcp 1251>null");
@@ -37,6 +90,15 @@ int main()
 	//ñòðîêà â ÷èñëî
 	double number = string_to_double(STR_TO_CONVERT);
 	printf("Ïðåîáðàçîâàííîå çíà÷åíèå: " FULL_PRECISION "\n", number);
+
+#if MODE == 1
+	calculate_otrezok();
+#elif MODE == 2
+	calculate_triangle();
+#else
+	no_mode();
+#endif
+
 	return 0;
 }
 

+ 1 - 0
ZagolovochnieFaily/arithmetic.h

@@ -4,6 +4,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <math.h>
 
 //int add(int a, int b); //Ôóíêöèÿ äëÿ ñëîæåíèÿ
 //int minus(int a, int b); //ÔÓíêöèÿ äëÿ âû÷èòàíèÿ

二進制
ZagolovochnieFaily/x64/Debug/Program.obj


二進制
ZagolovochnieFaily/x64/Debug/Zagolovo.278b04c5.tlog/CL.read.1.tlog


二進制
ZagolovochnieFaily/x64/Debug/Zagolovo.278b04c5.tlog/link.read.1.tlog


二進制
ZagolovochnieFaily/x64/Debug/ZagolovochnieFaily.ilk


二進制
ZagolovochnieFaily/x64/Debug/vc143.idb


二進制
ZagolovochnieFaily/x64/Debug/vc143.pdb


二進制
x64/Debug/ZagolovochnieFaily.exe


二進制
x64/Debug/ZagolovochnieFaily.pdb