salmimoro نشر 20 مايو 2016 أرسل تقرير مشاركة نشر 20 مايو 2016 لديّ هذا الكود المكتوب بلغة C وهو لبرنامج صغير، لا أدري أين المشكلة إلا أنه لا يعمل أرجو المساعدة #include <stdio.h> #include <stdlib.h> #include <string.h> struct employe { char nom[50] ; char prenon[50]; char fanction[50]; int salair[50]; char matricle[50]; } employe ; main() { FILE *index; int i,n; char nomfichier[50]; employe E; do { printf("entrez nom fichier\n"); scanf("%s",&nomfichier); index=fopen(nomfichier,"W"); if(!index) { printf("ereeur impossible \n"); } }whille(!index); printf("entrez nombre employe \n"); scanf("%d",&n) for(i=0;i<n;i++) { printf("entrez nom employe \n"); scanf("%S",&E.nom); printf("entrez prenon \n"); scanf("%S",&E.prenon); printf("entrez nom fanction \n"); scanf("%S",&E.fanction); printf("entrez salair \n"); scanf("%d",&E.salair); printf("entrez matricle \n"); scanf("%S",&E.matricle); fprintf(inex,"%s\n%s\n%s\n%s\n%d\n",&E.nom,&E.prenon,&E.fanction,&E.matricle&E.salair); } fclose(index); system("pause";) } اقتباس رابط هذا التعليق شارك على الشبكات الإجتماعية More sharing options...
1 سعيد نشر 21 مايو 2016 أرسل تقرير مشاركة نشر 21 مايو 2016 الحقيقة هناك العديد من الأخطاء نتيجة التسرّع في إدخال الشيفرة وعدم الانتباه. بعد عدّة تعديلات أجريتها على برنامجك، البرنامج التالي تمّت ترجمته بنجاح: #include <stdio.h> #include <stdlib.h> #include <string.h> struct Employe { char nom[50] ; char prenon[50]; char fanction[50]; int salair[50]; char matricle[50]; } employe ; int main() { FILE *index; int i,n; char nomfichier[50]; Employe E; do { printf("entrez nom fichier\n"); scanf("%s",&nomfichier); index=fopen(nomfichier,"W"); if(!index) { printf("ereeur impossible \n"); } }while(!index); printf("entrez nombre employe \n"); scanf("%d",&n); for(i=0;i<n;i++) { printf("entrez nom employe \n"); scanf("%S",&E.nom); printf("entrez prenon \n"); scanf("%S",&E.prenon); printf("entrez nom fanction \n"); scanf("%S",&E.fanction); printf("entrez salair \n"); scanf("%d",&E.salair); printf("entrez matricle \n"); scanf("%S",&E.matricle); fprintf(index,"%s\n%s\n%s\n%s\n%d\n",&E.nom,&E.prenon,&E.fanction,&E.matricle,&E.salair); } fclose(index); system("pause"); } إذا أحببت أن تعرف أخطائك، قارن بين برنامجي وبرنامجك اقتباس رابط هذا التعليق شارك على الشبكات الإجتماعية More sharing options...
السؤال
salmimoro
لديّ هذا الكود المكتوب بلغة C وهو لبرنامج صغير، لا أدري أين المشكلة إلا أنه لا يعمل
أرجو المساعدة
رابط هذا التعليق
شارك على الشبكات الإجتماعية
1 جواب على هذا السؤال
Recommended Posts
انضم إلى النقاش
يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.