Преглед на файлове

Перешел к препроцессору, заменил значения констант

Павлов Денис Александрович преди 3 седмици
родител
ревизия
650d2fb8fe

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


BIN
.vs/ZagolovochnieFaily/FileContentIndex/300df71f-cc0a-4766-ba96-9a03782c449c.vsidx


BIN
.vs/ZagolovochnieFaily/FileContentIndex/4a19a580-c0f8-45c7-9a81-b535ce1f4c49.vsidx


BIN
.vs/ZagolovochnieFaily/FileContentIndex/2d844e13-a5c6-456e-bfc7-a32a9e7448d1.vsidx → .vs/ZagolovochnieFaily/FileContentIndex/8150d822-a466-4590-a344-129560e26fdb.vsidx


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


BIN
.vs/ZagolovochnieFaily/FileContentIndex/c4241269-54f3-4ee0-b676-11f9670faecd.vsidx


BIN
.vs/ZagolovochnieFaily/v17/.suo


BIN
.vs/ZagolovochnieFaily/v17/Browse.VC.db


+ 19 - 5
.vs/ZagolovochnieFaily/v17/DocumentLayout.backup.json

@@ -9,6 +9,9 @@
     {
       "AbsoluteMoniker": "D:0:0:{278B04C5-704C-48F9-B716-964503E0D23E}|ZagolovochnieFaily\\ZagolovochnieFaily.vcxproj|D:\\Pavlov\\\u041C\u0414\u041A 01.04 \u041C\u0443\u0445\u0438\u043D\\ZagolovochnieFaily\\ZagolovochnieFaily\\arithmetic.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
       "RelativeMoniker": "D:0:0:{278B04C5-704C-48F9-B716-964503E0D23E}|ZagolovochnieFaily\\ZagolovochnieFaily.vcxproj|solutionrelative:ZagolovochnieFaily\\arithmetic.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
+    },
+    {
+      "AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.22621.0\\ucrt\\stdio.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
     }
   ],
   "DocumentGroupContainers": [
@@ -18,12 +21,23 @@
       "DocumentGroups": [
         {
           "DockedWidth": 200,
-          "SelectedChildIndex": 2,
+          "SelectedChildIndex": 3,
           "Children": [
             {
               "$type": "Bookmark",
               "Name": "ST:0:0:{cce594b6-0c39-4442-ba28-10c64ac7e89f}"
             },
+            {
+              "$type": "Document",
+              "DocumentIndex": 2,
+              "Title": "stdio.h",
+              "DocumentMoniker": "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.22621.0\\ucrt\\stdio.h",
+              "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": ""
+            },
             {
               "$type": "Document",
               "DocumentIndex": 1,
@@ -32,7 +46,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": "AgIAABsAAAAAAAAAAAAAADYAAAASAAAAAAAAAA==",
+              "ViewState": "AgIAABsAAAAAAAAAAAAAACkAAAAAAAAAAAAAAA==",
               "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
               "WhenOpened": "2024-10-18T07:25:00.766Z",
               "EditorCaption": ""
@@ -43,9 +57,9 @@
               "Title": "Program.c",
               "DocumentMoniker": "D:\\Pavlov\\\u041C\u0414\u041A 01.04 \u041C\u0443\u0445\u0438\u043D\\ZagolovochnieFaily\\ZagolovochnieFaily\\Program.c",
               "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": "AgIAAAkAAAAAAAAAAAAAACIAAAAmAAAAAAAAAA==",
+              "ToolTip": "D:\\Pavlov\\\u041C\u0414\u041A 01.04 \u041C\u0443\u0445\u0438\u043D\\ZagolovochnieFaily\\ZagolovochnieFaily\\Program.c*",
+              "RelativeToolTip": "ZagolovochnieFaily\\Program.c*",
+              "ViewState": "AgIAAAAAAAAAAAAAAAAAAAgAAAAZAAAAAAAAAA==",
               "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000423|",
               "WhenOpened": "2024-10-10T11:57:51.573Z",
               "EditorCaption": ""

+ 21 - 7
.vs/ZagolovochnieFaily/v17/DocumentLayout.json

@@ -2,13 +2,16 @@
   "Version": 1,
   "WorkspaceRootPath": "D:\\Pavlov\\\u041C\u0414\u041A 01.04 \u041C\u0443\u0445\u0438\u043D\\ZagolovochnieFaily\\",
   "Documents": [
+    {
+      "AbsoluteMoniker": "D:0:0:{278B04C5-704C-48F9-B716-964503E0D23E}|ZagolovochnieFaily\\ZagolovochnieFaily.vcxproj|D:\\Pavlov\\\u041C\u0414\u041A 01.04 \u041C\u0443\u0445\u0438\u043D\\ZagolovochnieFaily\\ZagolovochnieFaily\\Program.c||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
+      "RelativeMoniker": "D:0:0:{278B04C5-704C-48F9-B716-964503E0D23E}|ZagolovochnieFaily\\ZagolovochnieFaily.vcxproj|solutionrelative:ZagolovochnieFaily\\Program.c||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
+    },
     {
       "AbsoluteMoniker": "D:0:0:{278B04C5-704C-48F9-B716-964503E0D23E}|ZagolovochnieFaily\\ZagolovochnieFaily.vcxproj|D:\\Pavlov\\\u041C\u0414\u041A 01.04 \u041C\u0443\u0445\u0438\u043D\\ZagolovochnieFaily\\ZagolovochnieFaily\\arithmetic.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
       "RelativeMoniker": "D:0:0:{278B04C5-704C-48F9-B716-964503E0D23E}|ZagolovochnieFaily\\ZagolovochnieFaily.vcxproj|solutionrelative:ZagolovochnieFaily\\arithmetic.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
     },
     {
-      "AbsoluteMoniker": "D:0:0:{278B04C5-704C-48F9-B716-964503E0D23E}|ZagolovochnieFaily\\ZagolovochnieFaily.vcxproj|D:\\Pavlov\\\u041C\u0414\u041A 01.04 \u041C\u0443\u0445\u0438\u043D\\ZagolovochnieFaily\\ZagolovochnieFaily\\Program.c||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
-      "RelativeMoniker": "D:0:0:{278B04C5-704C-48F9-B716-964503E0D23E}|ZagolovochnieFaily\\ZagolovochnieFaily.vcxproj|solutionrelative:ZagolovochnieFaily\\Program.c||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
+      "AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.22621.0\\ucrt\\stdio.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
     }
   ],
   "DocumentGroupContainers": [
@@ -18,7 +21,7 @@
       "DocumentGroups": [
         {
           "DockedWidth": 200,
-          "SelectedChildIndex": 1,
+          "SelectedChildIndex": 3,
           "Children": [
             {
               "$type": "Bookmark",
@@ -26,26 +29,37 @@
             },
             {
               "$type": "Document",
-              "DocumentIndex": 0,
+              "DocumentIndex": 2,
+              "Title": "stdio.h",
+              "DocumentMoniker": "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.22621.0\\ucrt\\stdio.h",
+              "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": ""
+            },
+            {
+              "$type": "Document",
+              "DocumentIndex": 1,
               "Title": "arithmetic.h",
               "DocumentMoniker": "D:\\Pavlov\\\u041C\u0414\u041A 01.04 \u041C\u0443\u0445\u0438\u043D\\ZagolovochnieFaily\\ZagolovochnieFaily\\arithmetic.h",
               "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": "AgIAABsAAAAAAAAAAAAAADgAAAAGAAAAAAAAAA==",
+              "ViewState": "AgIAABsAAAAAAAAAAAAAACkAAAAAAAAAAAAAAA==",
               "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
               "WhenOpened": "2024-10-18T07:25:00.766Z",
               "EditorCaption": ""
             },
             {
               "$type": "Document",
-              "DocumentIndex": 1,
+              "DocumentIndex": 0,
               "Title": "Program.c",
               "DocumentMoniker": "D:\\Pavlov\\\u041C\u0414\u041A 01.04 \u041C\u0443\u0445\u0438\u043D\\ZagolovochnieFaily\\ZagolovochnieFaily\\Program.c",
               "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": "AgIAAAAAAAAAAAAAAAAAACIAAAAmAAAAAAAAAA==",
+              "ViewState": "AgIAAAAAAAAAAAAAAAAAABQAAABCAAAAAAAAAA==",
               "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000423|",
               "WhenOpened": "2024-10-10T11:57:51.573Z",
               "EditorCaption": ""

BIN
.vs/ZagolovochnieFaily/v17/ipch/AutoPCH/1aa652230783f010/PROGRAM.ipch


+ 11 - 8
ZagolovochnieFaily/Program.c

@@ -1,6 +1,13 @@
 #define _CRT_SECURE_NO_WARNINGS
 #include "arithmetic.h" //Âûçûâàþ ìîé çàãîëîâî÷íûé ôàéë
 
+
+#define STR1 "Hello, "
+#define STR2 "world!"
+#define STR_TO_CONVERT "213.124"
+#define PRECISION "%.2f"
+#define FULL_PRECISION "%.3f"
+
 int main()
 {
 	system("chcp 1251>null");
@@ -14,15 +21,13 @@ int main()
 	printf("Óìíîæåíèå: %d * %d = %d\n", num1, num2, umn(num1, num2));
 
 	if (num2 != 0) {
-		printf("Äåëåíèå: %d / %d = %.2f\n", num1, num2, del(num1, num2));
+		printf("Äåëåíèå: %d / %d = " PRECISION "\n", num1, num2, del(num1, num2));
 	}
 	else {
 		printf("Äåëåíèå íà íîëü íåâîçìîæíî!\n");
 	}
 
-	char* str1 = "Hello, ";
-	char* str2 = "world!";
-	char* result = concantenate_strings(str1, str2);
+	char* result = concantenate_strings(STR1, STR2);
 	printf("Îáúåäèíåííàÿ ñòðîêà: %s\n", result);
 	free(result);
 	//÷èñëî â ñòðîêó
@@ -30,10 +35,8 @@ int main()
 	printf("×èñëî %d êàê ñòðîêà: %s\n", num1, num_str);
 	free(num_str);
 	//ñòðîêà â ÷èñëî
-	const char* str_num = "4.12";
-	const char* endptr;
-	int number = string_to_int(str_num, &endptr);
-	printf("Ñòðîêà \"%s\" êàê ÷èñëî: %d\n", str_num, number);
+	double number = string_to_double(STR_TO_CONVERT);
+	printf("Ïðåîáðàçîâàííîå çíà÷åíèå: " FULL_PRECISION "\n", number);
 	return 0;
 }
 

+ 4 - 2
ZagolovochnieFaily/arithmetic.h

@@ -51,8 +51,10 @@ char* int_to_string(int num) {
 	return str;
 }
 
-int string_to_int(const char* str, const char* endptr) {
-	return strtol(str, &endptr, 10); //Ïðåîáðàçóþ ñòðîêó â ÷èñëî
+double string_to_double(const char* str) {
+	char* endptr;
+	double value = strtod(str, &endptr);
+	return value;
 }
 #endif
 

BIN
ZagolovochnieFaily/x64/Debug/Program.obj


BIN
ZagolovochnieFaily/x64/Debug/ZagolovochnieFaily.ilk


+ 0 - 2
ZagolovochnieFaily/x64/Debug/ZagolovochnieFaily.log

@@ -1,4 +1,2 @@
   Program.c
-D:\Pavlov\МДК 01.04 Мухин\ZagolovochnieFaily\ZagolovochnieFaily\Program.c(35,38): warning C4047: функция: "const char *" отличается по уровням косвенного обращения от "const char **"
-D:\Pavlov\МДК 01.04 Мухин\ZagolovochnieFaily\ZagolovochnieFaily\Program.c(35,38): warning C4024: string_to_int: различные типы для формального и фактического параметров 2
   ZagolovochnieFaily.vcxproj -> D:\Pavlov\МДК 01.04 Мухин\ZagolovochnieFaily\x64\Debug\ZagolovochnieFaily.exe

BIN
ZagolovochnieFaily/x64/Debug/vc143.idb


BIN
ZagolovochnieFaily/x64/Debug/vc143.pdb


BIN
x64/Debug/ZagolovochnieFaily.exe


BIN
x64/Debug/ZagolovochnieFaily.pdb