Skip to content

Instantly share code, notes, and snippets.

@manuel-delverme
Created January 13, 2016 23:26
Show Gist options
  • Save manuel-delverme/1fe5d6752e94695f8496 to your computer and use it in GitHub Desktop.
Save manuel-delverme/1fe5d6752e94695f8496 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define N 100
struct Names
{
char name[20];
char surname[20];
char number[20];
char mobile[20];
}Names;
int main()
{
struct Names ContactBook[N];
int z;
printf("choose one of these : \n 1.insert a new fucking contact : \n 2.exit\n ");
scanf("%d",&z);
while (z!=2)
{
int t;
printf("insert a name :");
scanf("%s",&ContactBook[t].name);
printf("insert surname:");
scanf("%s",&ContactBook[t].surname);
printf("insert a number :");
scanf("%s",&ContactBook[t].mobile);
printf("insert mobile:");
scanf("%s",&ContactBook[t]);
t++;
int w;
char name[] = "dghj"; /*useless things just to define and make my for loop work.*/
char surname[] = "dghj";/*useless things just to define and make my for loop work.*/
for(w=0; w<t; ++w)
{
if (ContactBook[t].name==ContactBook[w].name&&ContactBook[t].surname==ContactBook[w].surname)
{
printf("whoo warning that contact already exist!!");
t--;
}
}
printf("choose one of these : \n 1.insert a new fucking contact : \n 2.exit\n ");
scanf("%d",&z);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment