تجمع المبرمجين العرب️
رفتن به کانال در Telegram
الجروب مخصص للنقاش في مجال البرمجة فقط، وبخلافه سيتم حظر اي شخص يتكلم في أي مجال اخر غير مجال البرمجة
نمایش بیشترالعراقدسته بندی مشخص نشده است
7 902
مشترکین
اطلاعاتی وجود ندارد24 ساعت
اطلاعاتی وجود ندارد7 روز
اطلاعاتی وجود ندارد30 روز
آرشیو پست ها
-شركه software لجميع الخدمات البرمجيه
-python AI modules
-Web development (Flask & Django)
-Artificial intelligence-ذكاء اصطناعي
-Mopile application( flutter &android)
-Data analysis
WhatsApp +201010634589
#include <stdio.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
typedef struct contact {
char name[30],f_name[30];
char address[100];
char number[11];
char group[30];
}person;
_Bool is_valid_number(char* number) {
for(int i = 0; number[i] != '\0'; i++) {
if(!isdigit(number[i])) {
return 0;
}
}
return 1;
}
void main() {
int i,k;
char N[10];
_Bool exist=0;
char answer[4];
person t[40];
i=0;
k=0;
do{
printf("the %d person:\n", i+1);
printf("\t\tname: "); scanf(" %[^\n]",&t[i].name);
printf("\t\tfirst name: "); scanf(" %[^\n]",&t[i].f_name);
printf("\t\tenter the number:");
scanf("%s", &t[i].number);
while (!is_valid_number(t[i].number)) {
printf("Invalid number, please enter a valid phone number: ");
scanf("%s", t[i].number);
}
printf("\t\t enter the adress: "); scanf("%s", &t[i].address);
printf("\t\t enter the group of that person:"); scanf("%s", &t[i].group);
printf("\ndo u like to add new person ؟ (answer by yes/no) :\n");
scanf("%s", &answer);
i++;
k++;
}while(strcmp(answer,"yes")==0);
printf("enter the number that u search about:");
scanf("%s",&N);
for(i=0;i<k;i++){
if(strcmp(t[i].number,N)==0){
exist=1;
break;}
}
if(exist==1)
while(strcmp(t[i].number,N)==0){
printf("\nthe %d person is founded\n", i+1);
printf("information of the pirson that you search about :\n\n\tname: %s\n\tlast name : %s\n\taddress : %s\n\tgroup : %s",t[i].name,t[i].f_name,t[i].address,t[i].group);i++;
}
else{printf("\n not founded\n");}
//affichage of all person
for(i=0;i<k;i++){
printf("\nthe %d person is :\n\tname: %s\n\tlast name : %s\n\taddress : %s\n\tnumber:%s\n\tgroup : %s", i+1,t[i].name,t[i].f_name,t[i].address,t[i].number,t[i].group);
}
//
char reponse[4];
char x[30],y[30];
_Bool found=0;
int j;
int index_to_delete;
printf("do u wanna delet a person ؟ :");
scanf("%s", &reponse);
do{
printf("enter the name & first name of the person u wanna delet:\n");
scanf("name:%s\nlast name:%s",&x,&y);
for(i=0;i<k;i++)
if(strcmp(t[i].name,x)==0 && strcmp(t[i].f_name,y)==0){
found=1;
break;}
printf("do u wanna delet a person ؟ :");
scanf("%s", &reponse);
}while(strcmp(reponse,"yes")==0);
//affichage if it found or no then will deleted from list
//the delete of prson
/*
int r;
if (found) {
printf(" its founded and will be deleted:\n");
for (int r = index_to_delete; r < k - 1; r++) {
t[j] = t[j + 1];
}
k--;
} else {
printf("not fooound\n");
}
*/
return 0;
}
