#include<stdio.h>
#include<conio.h>
#include<windows.h>
#include<stdlib.h>
int hall=1;
int roll=1;
char chr='\n';
void main(void)
{ FILE *fp;
fp=fopen("TEXT.txt","w+");
int num,c,r,l,hallsize[10],row[10],col[10],search,sum,h;
printf("\t\tWELCOM\n");
printf("Number of students:>> ");
scanf("%d",&num);
printf("Number of Halls:>> ");
scanf("%d",&hall);
printf("\n\n");
for(int a=1;a<=hall;a++)
{
printf("Size of the room %d :>> ",a);
scanf("%d",&hallsize[a-1]);
}
printf("\n\n");
for(int a=1;a<=hall;a++)
{
printf("Row of hall %d:>> ",a);
scanf("%d",&row[a-1]);
printf("Col of hall %d:>> ",a);
scanf("%d",&col[a-1]);
}
for(int a=1;a<=hall;a++)
{
printf("\n\nHALL no %d\n\n",a);
fprintf(fp,"%c%c%c",chr,chr,chr);
for(int b=1;b<=row[a-1];b++)
{
fprintf(fp,"%c",chr);
for(int c=1;c<=col[a-1];c++)
{
printf("%d\t",roll);
fprintf(fp,"%d\t",roll);
roll++;
}
printf("\n");
}
}
printf("\n\nRoll you want to search:>> ");
scanf("%d",&search);
roll=1;
for(int a=1;a<=hall;a++)
{
for(int b=1;b<=row[a-1];b++)
{
for(int c=1;c<=col[a-1];c++)
{
if(search==roll){
h=a;
r=b;
l=c;
goto set;
}
roll++;
}
}
}
set:printf("\n\nHall %d\nRow %d\nCol %d",h,r,l);
fclose(fp);
getche();
}
This program will show you the seating plan by taking number of students and halls and row and columns of hall and assign them roll number and also search the student and tells its row,hall and column so you can easily trace it it will also create a TXT.txt file containing the seating plan so you it to impress your class friends.
#include<conio.h>
#include<windows.h>
#include<stdlib.h>
int hall=1;
int roll=1;
char chr='\n';
void main(void)
{ FILE *fp;
fp=fopen("TEXT.txt","w+");
int num,c,r,l,hallsize[10],row[10],col[10],search,sum,h;
printf("\t\tWELCOM\n");
printf("Number of students:>> ");
scanf("%d",&num);
printf("Number of Halls:>> ");
scanf("%d",&hall);
printf("\n\n");
for(int a=1;a<=hall;a++)
{
printf("Size of the room %d :>> ",a);
scanf("%d",&hallsize[a-1]);
}
printf("\n\n");
for(int a=1;a<=hall;a++)
{
printf("Row of hall %d:>> ",a);
scanf("%d",&row[a-1]);
printf("Col of hall %d:>> ",a);
scanf("%d",&col[a-1]);
}
for(int a=1;a<=hall;a++)
{
printf("\n\nHALL no %d\n\n",a);
fprintf(fp,"%c%c%c",chr,chr,chr);
for(int b=1;b<=row[a-1];b++)
{
fprintf(fp,"%c",chr);
for(int c=1;c<=col[a-1];c++)
{
printf("%d\t",roll);
fprintf(fp,"%d\t",roll);
roll++;
}
printf("\n");
}
}
printf("\n\nRoll you want to search:>> ");
scanf("%d",&search);
roll=1;
for(int a=1;a<=hall;a++)
{
for(int b=1;b<=row[a-1];b++)
{
for(int c=1;c<=col[a-1];c++)
{
if(search==roll){
h=a;
r=b;
l=c;
goto set;
}
roll++;
}
}
}
set:printf("\n\nHall %d\nRow %d\nCol %d",h,r,l);
fclose(fp);
getche();
}
This program will show you the seating plan by taking number of students and halls and row and columns of hall and assign them roll number and also search the student and tells its row,hall and column so you can easily trace it it will also create a TXT.txt file containing the seating plan so you it to impress your class friends.
ConversionConversion EmoticonEmoticon