hey need help with a welcome screen
hey guys i got a homework (which i have to submit today)in which we had to create an agenda which consisted of the person entering his name, address, age,.etc and then, the agenfda had a menu which had options to find the user by his anema nd .etc, this is my code check it out. im still learning ansi c, so a lot of people will tell me he why dont you use pointers, we still havent learned at the institue.
Code:
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<string.h>
struct listado{
char nombre[15];
char apellidos[25];
int edad;
int phone;
char DNI[20];
char direcion[60];
};
void busqueda(struct listado agenda[],int cantidad);
void mostrar(struct listado agenda[],int cantidad);
main()
{
int i,contact,opcion;
struct listado agenda[20];
char sal;
do
{
system("cls");
printf("******AGEND..........****");
printf("Menu Principal\n");
printf("1: Introducir los datos.\n");
printf("2: Buscar los datos.\n");
printf("3: Ver todos los contactos.\n");
printf("4: Salir.\n\n");
printf("Introdusca la opcion que desea realizar:");
scanf("%d",&opcion);
switch(opcion)
{
case 1:
system("cls");
printf(".\n");
printf("Cuantos contactos quieres introducir?:");
scanf("%d",&contact);
for(i=0;i<ca;i++){
printf("Contacto # %d \n",i+1);
printf("Introducir el Nombre:");
scanf("%s",&agenda[i].nombre);
printf("Introducir Apellidos:");
scanf("%s",&agenda[i].apellidos);
printf("Introducir Edad:");
scanf("%d",&agenda[i].edad);fflush(stdin);
printf("Introducir Telefono:");
scanf("%d",&agenda[i].phone);fflush(stdin);
printf("Introducir DNI:");
scanf("%s",&agenda[i].DNI);
printf("Introducir Direccion:");
scanf("%s",&agenda[i].direcion);
system("cls");
}
break;
case 2:
busqueda(agenda,ca);
break;
case 3:
mostrar(agenda,ca);
break;
case 4:
system("cls");
printf("Quieres salir?(S/N)");
sal=getch();
break;
}
}while(sal!='s');
getch();
system("cls");
printf("*************************Gracias por usar la agenda.****************************\n");
getch();
}
//Definicion de las funciones
void busqueda(struct listado agenda[],int cantidad)
{
char opcion;
int x,t,k,d;
char cade[15];
system("cls");
printf("Introdusca la referencia de busqueda:");
scanf("%s",&cade);
system("cls");
for(k=0,x=0;x<cantidad;x++){
if(strcmp(agenda[x].nombre, cade)== 0)
{
k++;
printf("Nombre:%s %s \nEdad:%d \nTelefono:%d \nDNI: %s\nDireccion: %s \n",agenda[x].nombre,agenda[x].apellidos,agenda[x].edad,agenda[x].phone,agenda[x].DNI,agenda[x].direcion);
printf("***************************************************\n");
}
else if (strcmp(agenda[x].DNI, cade)== 0)
{
k++;
printf("Nombre:%s %s \nEdad:%d \nTelefono:%d \nDNI: %s\nDireccion: %s \n",agenda[x].nombre,agenda[x].apellidos,agenda[x].edad,agenda[x].phone,agenda[x].DNI,agenda[x].direcion);
printf("***************************************************\n");
}
}
if(k==0)
{
printf("La referencia no existe.");
}
getch();
system("cls");
}
//Definicion de la 2da funcion
void mostrar(struct listado agenda[],int cantidad)
{
int i;
system("cls");
printf("Los contactos almacenados son:\n");
for(i=0;i<cantidad;i++){
printf("Nombre:%s %s \nEdad:%d \nTelefono:%d \nDNI:%s\nDireccion:%s \n",agenda[i].nombre,agenda[i].apellidos,agenda[i].edad,agenda[i].phone,agenda[i].DNI,agenda[i].direcion);
printf("***************************************************\n");
}
getch();
}
ok its in spanish sorry for that but what basically im looking for is a nice welcome screen like the one i have attached below,so whenever i start the program im presented with this screen and then at the end i would like another screen to say adios.
but i dont know how to do that if you guys coudl help me out. thanks a lot for reading.
and if you can find some bugs please let me know.