mirror of
https://github.com/ada-dmitry/prog.l_ada.git
synced 2026-09-24 01:00:15 +00:00
prog
This commit is contained in:
@@ -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);
|
||||||
|
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
#include<stdio.h>
|
||||||
|
#include<stdlib.h>
|
||||||
|
#include "st_func.h"
|
||||||
|
|
||||||
|
void st_rand(struct st1 temp[], int n){
|
||||||
|
int k;
|
||||||
|
int j;
|
||||||
|
|
||||||
|
srand(time(NULL));
|
||||||
|
for(k=0; k<n; k++){
|
||||||
|
(temp+k)->i = 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<n;k++){
|
||||||
|
printf("%d->[%2d][%s]\n", k, temp[k].i, (temp+k)->s);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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){
|
void st_print(struct st1 temp[], int n){
|
||||||
int k;
|
int k;
|
||||||
for(k=0;k<n;k++){
|
for(k=0;k<n;k++){
|
||||||
|
|||||||
Reference in New Issue
Block a user