Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Trabalho prog

View function.c
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
#include <stdio.h>
#include <stdlib.h>
struct item_agenda
{
 
char *nome;
int idade;
char sexo;
float ira;
char fone[10];
char email[200];
};
int ultimo, i, pos;
char nome[256];
struct item_agenda p[1000];
void shift(pos)
{
 
for (i = pos; i<1000; i++)
{
p[i+1] = p[i];
}
 
}
void incluir ()
{
printf ("Digite o nome");
gets(nome);
pos = position(nome);
shift(pos);
p[pos].nome = nome;
printf ("Digite a idade");
scanf ("%*d", p[ultimo].idade);
printf ("Digite o sexo (F ou M)");
scanf ("%*c", p[ultimo].sexo);
getchar();
printf ("Digite o ira");
scanf ("%*f", p[ultimo].ira);
getchar();
printf ("Digite o telefone");
gets(p[ultimo].fone);
printf ("Digite o email");
gets(p[ultimo].email);
}
int position(char n[256])
{
 
int menor;
for (i = 0; i<1000; i++)
{
 
if (p[0].nome[0] < n[0])
menor = i;
}
 
}
 
int main()
{
ultimo = 0;
incluir();
return EXIT_SUCCESS;
 
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.