Skip to content

Commit 06c1bcd

Browse files
authored
filing
1 parent e3ac95a commit 06c1bcd

File tree

2 files changed

+247
-0
lines changed

2 files changed

+247
-0
lines changed

filing.c

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#include<stdio.h>
2+
struct book{
3+
4+
char name[30];
5+
int price;
6+
int quantity;
7+
8+
9+
10+
}b[2];
11+
main(){
12+
int i;
13+
FILE *uu;
14+
uu=fopen("hello.txt","w");
15+
if (uu==NULL)
16+
{
17+
exit(1);
18+
}
19+
for(i=0;i<2;i++)
20+
{
21+
scanf(" %s %d %d",&b[i].name,&b[i].price,&b[i].quantity);
22+
23+
24+
}
25+
for(i=0;i<2;i++)
26+
{
27+
fprintf(uu,"%s %d %d",&b[i].name,&b[i].price,&b[i].quantity);
28+
29+
30+
31+
32+
33+
}
34+
fclose(uu);
35+
}

marksheet generator.c

+212
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
#include<stdio.h>
2+
#include<conio.h>
3+
#include<stdlib.h>
4+
#include<windows.h>
5+
#include<string.h>
6+
#include<stdlib.h>
7+
#define TRUE 1
8+
9+
10+
void new_marksheet();
11+
void list_all();
12+
struct personal{
13+
char name[50],fname[80],add[50],ph[50],school_name[50],m_grade[50];
14+
int sum,total;
15+
float m_per;
16+
};
17+
struct personal nm[100];
18+
int n=0;
19+
char numstr[50];
20+
void password_match();
21+
void main_menue();
22+
23+
void main(){
24+
25+
while(TRUE){
26+
27+
28+
printf("\n\t\tWELCOME TO MARKS SHEET GENERATOR...!\n");
29+
printf("\t\t=======================================");
30+
printf("\n\tPress Any Key To Continue the Program..!");
31+
getch();
32+
password_match();
33+
34+
}
35+
36+
37+
38+
}
39+
void password_match(){
40+
system("cls");
41+
char pass[100]="helloworld";
42+
char username[100],password[100];
43+
printf("\n\tPlease Enter the Following information for next Step...!");
44+
printf("\n\t\tPlease Enter the Password:");
45+
scanf("%s",&password);
46+
if ( strcmp(password,pass)==0)
47+
{
48+
printf("\n\t\tThanks for giving Correct User Name and Password\n");
49+
main_menue();
50+
}
51+
else{
52+
printf("\n\t\tEnter the Correct User-Name and Password\n");
53+
}
54+
}
55+
void main_menue(){
56+
char ch;
57+
system("cls");
58+
printf("\n\t\tWELCOME TO MARKS SHEET GENERATOR...!\n");
59+
printf("\t\t=======================================");
60+
printf("\n\n\t\tPress [1] for Creating Marksheet");
61+
printf("\n\n\t\tPress [2] For saving data in file");
62+
printf("\n\n\t\tPress [3] Exit\n");
63+
ch=getch();
64+
switch(ch){
65+
case '1':
66+
new_marksheet();
67+
break;
68+
69+
case '2':
70+
list_all();
71+
break;
72+
73+
case '3':
74+
exit(0);
75+
break;
76+
77+
78+
79+
default:
80+
printf(" Invalid Selection");
81+
82+
}
83+
}
84+
85+
86+
void new_marksheet()
87+
{
88+
89+
90+
91+
92+
system("cls");
93+
printf("\n\t\tWELCOME TO MARKS SHEET GENERATOR...!\n");
94+
printf("\t\t=======================================");
95+
printf("\nMarksheet id No: %d",n+1);
96+
printf("\nEnter the Stundent Name:\n");
97+
scanf("%s",nm[n].name);
98+
printf("\nEnter the Father Name:\n");
99+
scanf("%s",nm[n].fname);
100+
printf("\nEnter the Address:\n");
101+
scanf("%s",nm[n].add);
102+
printf("\nEnter the Contact No:\n");
103+
scanf("%s",nm[n].ph);
104+
printf("\nEnter the School Name:\n");
105+
scanf("%s",nm[n].school_name);
106+
107+
printf("\n\t\t======================================");
108+
printf("\n\t\tSubject Session\n");
109+
printf("\n\t\t======================================");
110+
printf("\n\t\tEnter the Subject's Marks");
111+
printf("\n\t\t======================================\n");
112+
int sub[5],ob=0,i=0;
113+
for(i=1;i<=5;i++){
114+
printf("Enter Subject [%d] Mark's:\n",i);
115+
scanf("%d",&sub[i]);
116+
ob=nm[n].sum+=sub[i];
117+
}
118+
printf("\nMARKS OBTAINED=%d\n",nm[n].sum);
119+
float per;
120+
char ass[100];
121+
per=ob/500.00*100;
122+
nm[n].m_per=per;
123+
printf("\nPERCENTAGE=%f",nm[n].m_per);
124+
if(per >= 80)
125+
{
126+
printf("\nGRADE=A-1\n");
127+
128+
nm[n++].m_grade==ass;
129+
}
130+
else if ( per >=70)
131+
{
132+
printf("\nGRADE=A\n");
133+
134+
nm[n++].m_grade==ass;
135+
}
136+
else if ( per >=60)
137+
{
138+
printf("\nGRADE=B\n");
139+
140+
nm[n++].m_grade==ass;
141+
}
142+
else if ( per >=40)
143+
{
144+
printf("\nGRADE=C\n");
145+
146+
nm[n++].m_grade==ass;
147+
}
148+
else if ( per < 40)
149+
{
150+
printf("\nFAIL\n");
151+
152+
nm[n++].m_grade==ass;
153+
}
154+
155+
156+
}
157+
158+
void list_all()
159+
{
160+
system("cls");
161+
162+
printf("\n\n\t\t\tList of All Record in File..!\n");
163+
printf("\t\t=========================================\n");
164+
165+
int j=0;
166+
if(n<1){
167+
printf("No Record has found in File\n");
168+
}
169+
FILE *fp;
170+
fp=fopen("myfile.txt","w");
171+
if(fp==NULL)
172+
{
173+
174+
printf("error opening file \n");
175+
176+
exit(1);
177+
}
178+
179+
180+
181+
182+
for(j=0;j<n;j++){
183+
fprintf(fp,"\t\tMARKS SHEET NUMBER:[%d]\n",n+1);
184+
fprintf(fp,"\tNAME:%s\n",nm[j].name);
185+
fprintf(fp,"\tFATHER NAME:%s\n",nm[j].fname);
186+
fprintf(fp,"\tADDRESS:%s\n",nm[j].add);
187+
fprintf(fp,"\tPHONE NUMBER:%s\n",nm[j].ph);
188+
fprintf(fp,"\tSCHOOL NAME:%s\n",nm[j].school_name);
189+
fprintf(fp,"\tPERCENTAGE:%.2f\n",nm[j].m_per);
190+
fprintf(fp,"\tOBTAINED MARKS:%d\n",nm[j].sum);
191+
fprintf(fp,"\tTOTAL MARKS:500\n");
192+
fprintf(fp,"\tGRADE:%s\n",nm[j].m_grade);
193+
194+
}
195+
fclose(fp);
196+
}
197+
198+
199+
200+
201+
202+
203+
204+
205+
206+
207+
208+
209+
210+
211+
212+

0 commit comments

Comments
 (0)