+ 1

guys i want to create command text and when i write command text :dosya1 i want to see dosya1 on execuation place please help

#include <stdio.h> #include <stdlib.h> #include <string.h> #define LINE_LENGTH 256 int main(){ FILE *dosya; char Ismi[50][50]; char number[10][10]; //'number' holds students number int index=0; printf("LIST 1\n"); printf("\n"); if ((dosya =fopen("dosya.txt","r"))!= NULL){ while (!feof(dosya)){ fscanf(dosya, "%s %s ",&number[index],&Ismi[index]); index++; } for(int i=0;i<index;i++){ printf(" %s %s \n ",number[i],Ismi[i]); } } else { printf("not found"); } fclose(dosya); char list2(); printf("LIST 2\n"); printf("\n"); FILE *dosya1; char Ismi1[50][50]; char yaz[50][50]; int index1=0; if ((dosya1 =fopen("dosya1.txt","r"))!= NULL){ while (!feof(dosya1)){ fscanf(dosya1, " %s %s \n ",&Ismi1[index1],&yaz[index1]); index1++; } for(int i=0;i<index1;i++){ printf(" %s %s \n ",Ismi1[i],yaz[i]); } } else { printf("not found"); char list(); } fclose(dosya1); printf("LIST 3"); printf("\n"); printf("\n"); FILE *dosya2; char Ismi2[50][50]; int code[1]; //'code' holds credit of the lectures char code1[5][5]; //'code1' holds code of lectures int index2=0; if ((dosya2 =fopen("dosya2.txt","r"))!= NULL){ while (!feof(dosya2)){ fscanf(dosya2, "%s %s %d ",&code1[index2],&Ismi2[index2],&code[index2]); index2++; } for(int ii=0;ii<index2;ii++){ printf("%s %s %d \n ",code1[ii],Ismi2[ii],code[ii]); } } else { printf("not found"); } fclose(dosya2); }

21st Oct 2020, 7:33 PM
mert ozmen
mert ozmen - avatar
1 Respuesta