Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

glkink / C-programming

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Members
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Commit 7be23875 authored 3 years ago by glkink's avatar glkink
Browse files
Options
  • Browse Files
  • Download
  • Email Patches
  • Plain Diff

inimesed.txt

25
12:00 0
12:02 1
12:03 4
12:05 5
12:06 6
12:08 7
12:09 9
12:10 12
12:11 13
12:12 15
12:13 18
12:15 16
12:16 14
12:17 10
12:18 7
12:21 8
12:23 10
12:25 11
12:26 12
12:30 11
12:32 9
12:37 5
12:39 2
12:40 1
12:41 0
 
parent f392187b
Show whitespace changes
Inline Side-by-side
Showing with 48 additions and 0 deletions
  • inimesteloendus
inimesteloendus 0 → 100644
View file @ 7be23875
#include <stdio.h>
#include <stdlib.h>
struct inimesed
{
char aeg[20];
int inimesteArv;
} info[50];
void main()
{
struct inimesed ajutine;
FILE *fail;
int i = 0, n, j;
char t;
fail = fopen("inimesed.txt", "r");
if (fail == NULL)
{
printf("Ei saa faili avada! \n");
exit(0);
}
fscanf(fail, "%d", &n);
while (i < n)
{
fscanf(fail, "%s%d", info[i].aeg, &info[i].inimesteArv);
t = fgetc(fail);
i++;
}
for (i = 1; i < n; ++i)
{
for (j = 0; j < n - i; j++)
{
if (info[j + 1].inimesteArv > info[j].inimesteArv)
{
ajutine = info[j];
info[j] = info[j + 1];
info[j + 1] = ajutine;
}
}
}
for (i = 0; i < n; i++)
{
printf("%d %s\n", info[i].inimesteArv, info[i].aeg);
}
}
This diff is collapsed. Click to expand it.
  • Write
  • Preview
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment