From 6740b748f45a6f40f510386166d2a9e756a084c9 Mon Sep 17 00:00:00 2001 From: ada-dmitry Date: Tue, 14 Mar 2023 12:40:00 +0300 Subject: [PATCH] prog --- Lesson/14.03/Project1/st.func.h | 9 +++++++++ Lesson/14.03/Project1/st_func.c | 24 ++++++++++++++++++++++++ Lesson/14.03/l2.c | 4 ++++ 3 files changed, 37 insertions(+) create mode 100644 Lesson/14.03/Project1/st.func.h create mode 100644 Lesson/14.03/Project1/st_func.c diff --git a/Lesson/14.03/Project1/st.func.h b/Lesson/14.03/Project1/st.func.h new file mode 100644 index 0000000..f53934b --- /dev/null +++ b/Lesson/14.03/Project1/st.func.h @@ -0,0 +1,9 @@ + +struct st1{ + int i; + char s[128]; +}; + +void st_rand(struct st1 temp[], int n); +void st_print(struct st1 temp[], int n); + \ No newline at end of file diff --git a/Lesson/14.03/Project1/st_func.c b/Lesson/14.03/Project1/st_func.c new file mode 100644 index 0000000..0a5831d --- /dev/null +++ b/Lesson/14.03/Project1/st_func.c @@ -0,0 +1,24 @@ +#include +#include +#include "st_func.h" + +void st_rand(struct st1 temp[], int n){ + int k; + int j; + + srand(time(NULL)); + for(k=0; ki = rand()%100; + for(j=0;j<127;j++){ + (temp+k)->s[j]=((char)(65+rand()%25)); + } + (temp+k)->s[127]='\0'; + } +} + +void st_print(struct st1 temp[], int n){ + int k; + for(k=0;k[%2d][%s]\n", k, temp[k].i, (temp+k)->s); + } +} diff --git a/Lesson/14.03/l2.c b/Lesson/14.03/l2.c index d19ca2e..6405018 100644 --- a/Lesson/14.03/l2.c +++ b/Lesson/14.03/l2.c @@ -24,6 +24,10 @@ void st_rand(struct st1 temp[], int n){ } } +/*void swap(struct st1 temp[], int c, int d, int n){ + Дописать функцию! +} +*/ void st_print(struct st1 temp[], int n){ int k; for(k=0;k