Notes![what is notes.io? What is notes.io?](/theme/images/whatisnotesio.png)
![]() ![]() Notes - notes.io |
#include<string.h>
#include<stdlib.h>
struct data{
int id,sitnum;
char name[20];
float d[5],d25[5],points,gpa;
};
int sethours();
void printall(struct data[]);
main()
{
int *p1,h[5],i,j,k,l,m,n,sumhours,choose;
struct data std[10];
FILE *ff;
//Checking Data
if((ff=fopen("E:\txt.txt","r"))!=NULL)
{
//GO TO
}
//Hours
p1=sethours();
for(i=0;i<5;i++)
{
h[i]=*p1;
p1++;
}
//all hours
sumhours=*p1;
//Entering data
printf("Enter The data of 10 Students");
for(j=0;j<10;j++)
{
printf("For Student %dnEnter id : ",j+1);
scanf("%d",&std[j].id);
printf("nEnter Sitting number ");
scanf("%d",&std[j].sitnum);
printf("nEnter the name ");
//gets(std[j].name);
scanf("%s",std[j].name);
//Degrees
for(k=0;k<5;k++)
{
printf("nEnter the Degree no.%d ",k+1);
scanf("%f",&std[j].d[k]);
}
for(l=0;l<5;l++)
{
std[j].d25[l]=std[j].d[l]/25;
}
//points
std[j].points=0;
for(m=0;m<5;m++)
{
std[j].points=std[j].points+(std[j].d25[m]*h[m]);
}
//Gpa
std[j].gpa=std[j].points/sumhours;
}
//Wrinting Data
if((ff=fopen("E:\txt.txt","w"))==NULL)
{
printf("nError in Writing Data in File ");
exit(1);
}
// fprintf(ff,"IdtSitting NumbertName d1 d2 d3 d4 d5 Points GPAn")
for(n=0;n<10;n++)
{
fprintf(ff,"%dt%dt %st%.2f %.2f %.2f %.2f %.2f %.2f %.2fn",std[n].id,std[n].sitnum,std[n].name,std[n].d[0],std[n].d[1],std[n].d[2],std[n].d[3],std[n].d[4],std[n].points,std[n].gpa);
}
printf("n Data Entered successfullynWhat Do you want to do?nEnter 1 for Print all data of Students n>>");
scanf("%d",&choose);
switch(choose)
{
case 1 :
{
printall(std);
}
}
/*
//Printing data
printf("nThe details Of Student isn");
printf("IdtSitting NumbertName td1 d2 d3 d4 d5 Points GPAn");
for(n=0;n<10;n++)
{
printf("%dt%dt %st%f %f %f %f %f %.3f %.3fn",std[n].id,std[n].sitnum,std[n].name,std[n].d[0],std[n].d[1],std[n].d[2],std[n].d[3],std[n].d[4],std[n].points,std[n].gpa);
}
*/
}
int sethours()
{
int h[6],i,k,sum=0,*p=h;
printf("Enter Hours for :n");
for(i=0;i<5;i++)
{
printf("Subject %d ",i+1);
scanf("%d",&h[i]);
}
for(k=0;k<5;k++)
{
sum=sum+h[k];
}
h[5]=sum;
return p;
}
void printall(struct data std[])
{
int n;
//Printing all data
printf("nThe details Of all Student isn");
printf("IdtSitting NumbertName d1 d2 d3 d4 d5 Points GPAn");
for(n=0;n<10;n++)
{
printf("%dt %dt %st%.2f %.2f %.2f %.2f %.2f %.2f %.2fn",std[n].id,std[n].sitnum,std[n].name,std[n].d[0],std[n].d[1],std[n].d[2],std[n].d[3],std[n].d[4],std[n].points,std[n].gpa);
}
}
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team