Subscribe to Feeds

Send Your COMPLETED Projects To georgepj@hotmail.com

We'll Publish It With Your Name :-)

Programs Can Also Be Downloaded From The Folders Below....[Or Scroll Down]

Progress Report

Click Here To Download C++ File Of This Program

 //Downloaded From www.c4cpp.co.nr 
//(C)2009.All rights reserved.
#include<iostream.h>
#include<conio.h>
#include<dos.h>
#include<stdio.h>
#include<fstream.h>
struct stud
{
public:
int rno;
char name[50];
int cls;
float marks[5];
};
struct res
{
int rnos;
float total;
char grade;
float perc;
};
void main()
{
clrscr();
float tm;
int i,ma;
stud st;
res rt;
ofstream gpj("stud.dat",ios::binary|ios::trunc);
ofstream jpg("result.dat",ios::binary|ios::trunc);
if(!gpj||!jpg)
cout<<"File Cannot Be Created"<<endl;
int n;
if(gpj&&jpg)
{
cout<<"How mamy Students U Want to Enter ???? "<<endl;
cin>>n;
for(i=0;i<n;i++)
{
cout<<"Enter Name"<<endl;
gets(st.name);
cout<<"Enter Roll No"<<endl;
cin>>st.rno;
cout<<"Enter Class"<<endl;
cin>>st.cls;
for(ma=0;ma<5;ma++)
{
cout<<"Enter Marks in subj"<<ma+1<<endl;
cin>>st.marks[ma];
}
gpj.write((char*)&st,sizeof(st));
tm=st.marks[0]+st.marks[2]+st.marks[1]+st.marks[3]+st.marks[4];
rt.perc=tm/5;
if(rt.perc>=75)
rt.grade='A';
if((rt.perc>=60)&&(rt.perc<75))
rt.grade='B';
if((rt.perc>=50)&&(rt.perc<60))
rt.grade='C';
if((rt.perc>=40)&&(rt.perc<50))
rt.grade='D';
if(rt.perc<40)
rt.grade='F';
rt.rnos=st.rno;
jpg.write((char*)&rt,sizeof(rt));
}}
gpj.close();
jpg.close();
int r,k=0;
ifstream god("result.dat",ios::binary);
if(!god)
{
cout<<"File Erroe"<<endl;
}
else
{
god.seekg(0);
cout<<endl<<"ENTER ROLL NO"<<endl;
cin>>r;
while(god.read((char*)&rt,sizeof(rt)))
{
if(r==rt.rnos)
{
k++;
cout<<" Roll no :"<<rt.rnos<<endl<<" Percentage :"<<rt.perc<<endl<<" Grade :"<<rt.grade;
}
}
if(k==0)
cout<<"Roll no not present"<<endl;
god.close();
}
getch();
}

No comments: