Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int Add_info()
- {
- char name[30];
- FILE *fptr;
- int id;
- float intake, section;
- fptr = fopen("emp.txt", "w+");/* open for writing */
- if (fptr == NULL)
- {
- printf("File does not exists \n");
- return;
- }
- printf("Enter the id\n");
- scanf("%d", &id);
- fprintf(fptr, "Id= %d\n", id);
- printf("Enter the name \n");
- scanf("%s", name);
- fprintf(fptr, "Name= %s\n", name);
- printf("Enter the Intake\n");
- scanf("%f", &intake);
- fprintf(fptr, "Intake= %.2f\n", intake);
- printf("Enter the Section\n");
- scanf("%f", §ion);
- fprintf(fptr, "Section= %.2f\n", section);
- fclose(fptr);
- FILE *fp;
- char buff[255];//creating char array to store data of file
- fp = fopen("emp.txt", "r");
- while(fscanf(fp, "%s", buff)!=EOF){
- printf("%s ", buff);
- }
- fclose(fp);
- }
- int show_list()
- {
- FILE *fp;
- char buff[255];//creating char array to store data of file
- fp = fopen("emp.txt", "r");
- while(fscanf(fp, "%s", buff)!=EOF){
- printf("%s \n", buff);
- }
- fclose(fp);
- }
- int sim_info()
- {
- printf("Idea Sim OF THE PROJECT: \n");
- printf("1. Sim Info \n");
- printf("2. Sim List \n");
- printf("3. Update Info \n");
- printf("4. Delete Info\n");
- int ch;
- printf("Enter your Choice: ");
- scanf("%d", &ch);
- switch(ch)
- {
- case 1:
- Add_info();
- break;
- case 2:
- show_list();
- break;
- default:
- printf("Wrong Input\n");
- }
- }
- int User()
- {
- printf("Nothing\n");
- }
- int Admin()
- {
- printf("ADMIN PANEL OF THE PROJECT: \n");
- printf("1. Idea Sim \n");
- printf("2. Login \n");
- printf("3. Sim Information \n");
- printf("4. My Account\n");
- printf("5. Offers \n");
- printf("6. Emergency Contact \n");
- printf("7. Exit \n");
- int ch;
- printf("Enter your Choice: ");
- scanf("%d", &ch);
- switch(ch)
- {
- case 1:
- idea_sim();
- break;
- case 2:
- idea_sim();
- break;
- default:
- printf("Wrong Input\n");
- }
- }
- int main()
- {
- printf("PROJECT NAME : SIM MANAGEMENT SYSTEM\n\n\n\n\n\n");
- printf("1. USER LOGIN\n");
- printf("2. ADMIN LOGIN\n");
- int ch;
- printf("Enter Your Choice: ");
- scanf("%d", &ch);
- switch(ch)
- {
- case 1:
- User();
- break;
- case 2:
- Admin();
- break;
- default:
- printf("Wrong Input\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement