Skip to content

@dennermiranda /function.c
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Trabalho prog
#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.