FINAL PROJECT
// file.1.mzr.cpp : Defines the entry point for the console application.
// Final Project of 1st semester. Student record.
#include "stdafx.h"
#include<iostream>
#include<fstream>
#include<iomanip>
using namespace std;
struct record
{
char name[30];
char f_name[30];
char date_birth[15];
char address[50];
int misid;
char reg[50];
char program[10];
char depart[20];
char semester[10];
char shift[20];
char section;
char sub1[30];
char sub1_code[20];
int sub1_marks;
char sub2[30];
char sub2_code[20];
int sub2_marks;
char sub3[30];
char sub3_code[20];
int sub3_marks;
char sub4[30];
char sub4_code[20];
int sub4_marks;
char sub5[30];
char sub5_code[20];
int sub5_marks;
char sub6[30];
char sub6_code[20];
int sub6_marks;
};
int _tmain(int argc, _TCHAR* argv[])
{
record student;
int total_marks=0;
char op;
do
{
cout<<"Input Record: "<<endl;
cout<<"Enter Student Name?"<<endl;
cin>>student.name;
cout<<"Enter Student`s Father Name?"<<endl;
cin>>student.f_name;
cout<<"Enter Student`s Date of birth?"<<endl;
cin>>student.date_birth;
cout<<"Enter Student`s Address?"<<endl;
cin>>student.address;
cout<<"Enter Student`s MISID?"<<endl;
cin>>student.misid;
cout<<"Enter Student`s Registration No#?"<<endl;
cin>>student.reg;
cout<<"Enter Program?"<<endl;
cin>>student.program;
cout<<"Enter Department?"<<endl;
cin>>student.depart;
cout<<"Enter Semester?"<<endl;
cin>>student.semester;
cout<<"Enter Shift?"<<endl;
cin>>student.shift;
cout<<"Enter Section?"<<endl;
cin>>student.section;
cout<<"Enter 1st Subject?"<<endl;
cin>>student.sub1;
cout<<"Enter 1st Subject Code?"<<endl;
cin>>student.sub1_code;
cout<<"Enter 1st Subject Marks?"<<endl;
cin>>student.sub1_marks;
cout<<"Enter 2nd Subject?"<<endl;
cin>>student.sub2;
cout<<"Enter 2nd Subject Code?"<<endl;
cin>>student.sub2_code;
cout<<"Enter 2nd Subject Marks?"<<endl;
cin>>student.sub2_marks;
cout<<"Enter 3rd Subject?"<<endl;
cin>>student.sub3;
cout<<"Enter 3rd Subject Code?"<<endl;
cin>>student.sub3_code;
cout<<"Enter 3rd Subject Marks?"<<endl;
cin>>student.sub3_marks;
cout<<"Enter 4rth Subject?"<<endl;
cin>>student.sub4;
cout<<"Enter 4rth Subject Code?"<<endl;
cin>>student.sub4_code;
cout<<"Enter 4rth Subject Marks?"<<endl;
cin>>student.sub4_marks;
cout<<"Enter 5th Subject?"<<endl;
cin>>student.sub5;
cout<<"Enter 5th Subject Code?"<<endl;
cin>>student.sub5_code;
cout<<"Enter 5th Subject Marks?"<<endl;
cin>>student.sub5_marks;
cout<<"Enter 6th Subject?"<<endl;
cin>>student.sub6;
cout<<"Enter 6th Subject Code?"<<endl;
cin>>student.sub6_code;
cout<<"Enter 6th Subject Maks?"<<endl;
cin>>student.sub6_marks;
total_marks = student.sub1_marks + student.sub2_marks + student.sub3_marks + student.sub4_marks + student.sub5_marks + student.sub6_marks;
cout<<setw(40);
ofstream file;
file.open("file.txt");
cout<<"Record: "<<endl<<endl;
cout<<"Name :\t"<<student.name<<endl;
cout<<"Father`s Name:\t"<<student.f_name<<endl ;
cout<<"Address:\t"<<student.ad dress<<endl;
cout<<"MISID:\t"<<student.misi d<<endl;
cout<<"Registration No#:\t"<<student.reg<<endl;
cout<<"Program:\t"<<student.pr ogram<<endl;
cout<<"Department:\t"<<student .depart<<endl;
cout<<"Semester:\t"<<student.s emester<<"\t";
cout<<"Shift:\t"<<student.shif t<<"\t";
cout<<"Section:\t"<<student.se ction<<endl;
cout<<"1st Subject:\t"<<student.sub1<<"\n 1st Subject Code:\t"<<student.sub1_code<<" \n1st Subject Marks:\t"<<student.sub1_marks< <endl;
cout<<"2nd Subject:\t"<<student.sub2<<"\n 2nd Subject Code:\t"<<student.sub2_code<<" \n2nd Subject Marks:\t"<<student.sub2_marks< <endl;
cout<<"3rd Subject:\t"<<student.sub3<<"\3 rd Subject Code:\t"<<student.sub3_code<<" \n3rd Subject Marks:\t"<<student.sub3_marks< <endl;
cout<<"4rth Subject:\t"<<student.sub4<<"\n 4rth Subject Code:\t"<<student.sub4_code<<" \n4rth Subject Marks:\t"<<student.sub4_marks< <endl;
cout<<"5th Subject:\t"<<student.sub5<<"\n 5th Subject Code:\t"<<student.sub5_code<<" \n5th Subject Marks:\t"<<student.sub5_marks< <endl;
cout<<"6th Subject:\t"<<student.sub6<<"\n 6th Subject Code:\t"<<student.sub6_code<<" \n6th Subject Marks:\t"<<student.sub6_marks< <endl;
cout<<"TotalMarks:\t"<<total_m arks<<endl;
file<<"Record:"<<endl;
file<<"Name :\t"<<student.name<<endl;
file<<"Father`s Name:\t"<<student.f_name<<endl ;
file<<"Address:\t"<<student.ad dress<<endl;
file<<"MISID:\t"<<student.misi d<<endl;
file<<"Registration No#:\t"<<student.reg<<endl;
file<<"Program:\t"<<student.pr ogram<<endl;
file<<"Department:\t"<<student .depart<<endl;
file<<"Semester:\t"<<student.s emester<<"\t";
file<<"Shift:\t"<<student.shif t<<"\t";
file<<"Section:\t"<<student.se ction<<endl;
file<<"1st Subject:\t"<<student.sub1<<"\n 1st Subject Code:\t"<<student.sub1_code<<" \n1st Subject Marks:\t"<<student.sub1_marks< <endl;
file<<"2nd Subject:\t"<<student.sub2<<"\n 2nd Subject Code:\t"<<student.sub2_code<<" \n2nd Subject Marks:\t"<<student.sub2_marks< <endl;
file<<"3rd Subject:\t"<<student.sub3<<"\3 rd Subject Code:\t"<<student.sub3_code<<" \n3rd Subject Marks:\t"<<student.sub3_marks< <endl;
file<<"4rth Subject:\t"<<student.sub4<<"\n 4rth Subject Code:\t"<<student.sub4_code<<" \n4rth Subject Marks:\t"<<student.sub4_marks< <endl;
file<<"5th Subject:\t"<<student.sub5<<"\n 5th Subject Code:\t"<<student.sub5_code<<" \n5th Subject Marks:\t"<<student.sub5_marks< <endl;
file<<"6th Subject:\t"<<student.sub6<<"\n 6th Subject Code:\t"<<student.sub6_code<<" \n6th Subject Marks:\t"<<student.sub6_marks< <endl;
file<<"TotalMarks:\t"<<total_m arks<<endl;
cout<<"For Entering more Record for students Press y (yes), otherwise Press n (no)?"<<endl;
cin>>op;
}
while (op == 'Y' || op == 'y');
cout<<"Ok!!! GOOD BYE.....!!";
return 0;
}
// file.1.mzr.cpp : Defines the entry point for the console application.
// Final Project of 1st semester. Student record.
#include "stdafx.h"
#include<iostream>
#include<fstream>
#include<iomanip>
using namespace std;
struct record
{
char name[30];
char f_name[30];
char date_birth[15];
char address[50];
int misid;
char reg[50];
char program[10];
char depart[20];
char semester[10];
char shift[20];
char section;
char sub1[30];
char sub1_code[20];
int sub1_marks;
char sub2[30];
char sub2_code[20];
int sub2_marks;
char sub3[30];
char sub3_code[20];
int sub3_marks;
char sub4[30];
char sub4_code[20];
int sub4_marks;
char sub5[30];
char sub5_code[20];
int sub5_marks;
char sub6[30];
char sub6_code[20];
int sub6_marks;
};
int _tmain(int argc, _TCHAR* argv[])
{
record student;
int total_marks=0;
char op;
do
{
cout<<"Input Record: "<<endl;
cout<<"Enter Student Name?"<<endl;
cin>>student.name;
cout<<"Enter Student`s Father Name?"<<endl;
cin>>student.f_name;
cout<<"Enter Student`s Date of birth?"<<endl;
cin>>student.date_birth;
cout<<"Enter Student`s Address?"<<endl;
cin>>student.address;
cout<<"Enter Student`s MISID?"<<endl;
cin>>student.misid;
cout<<"Enter Student`s Registration No#?"<<endl;
cin>>student.reg;
cout<<"Enter Program?"<<endl;
cin>>student.program;
cout<<"Enter Department?"<<endl;
cin>>student.depart;
cout<<"Enter Semester?"<<endl;
cin>>student.semester;
cout<<"Enter Shift?"<<endl;
cin>>student.shift;
cout<<"Enter Section?"<<endl;
cin>>student.section;
cout<<"Enter 1st Subject?"<<endl;
cin>>student.sub1;
cout<<"Enter 1st Subject Code?"<<endl;
cin>>student.sub1_code;
cout<<"Enter 1st Subject Marks?"<<endl;
cin>>student.sub1_marks;
cout<<"Enter 2nd Subject?"<<endl;
cin>>student.sub2;
cout<<"Enter 2nd Subject Code?"<<endl;
cin>>student.sub2_code;
cout<<"Enter 2nd Subject Marks?"<<endl;
cin>>student.sub2_marks;
cout<<"Enter 3rd Subject?"<<endl;
cin>>student.sub3;
cout<<"Enter 3rd Subject Code?"<<endl;
cin>>student.sub3_code;
cout<<"Enter 3rd Subject Marks?"<<endl;
cin>>student.sub3_marks;
cout<<"Enter 4rth Subject?"<<endl;
cin>>student.sub4;
cout<<"Enter 4rth Subject Code?"<<endl;
cin>>student.sub4_code;
cout<<"Enter 4rth Subject Marks?"<<endl;
cin>>student.sub4_marks;
cout<<"Enter 5th Subject?"<<endl;
cin>>student.sub5;
cout<<"Enter 5th Subject Code?"<<endl;
cin>>student.sub5_code;
cout<<"Enter 5th Subject Marks?"<<endl;
cin>>student.sub5_marks;
cout<<"Enter 6th Subject?"<<endl;
cin>>student.sub6;
cout<<"Enter 6th Subject Code?"<<endl;
cin>>student.sub6_code;
cout<<"Enter 6th Subject Maks?"<<endl;
cin>>student.sub6_marks;
total_marks = student.sub1_marks + student.sub2_marks + student.sub3_marks + student.sub4_marks + student.sub5_marks + student.sub6_marks;
cout<<setw(40);
ofstream file;
file.open("file.txt");
cout<<"Record: "<<endl<<endl;
cout<<"Name :\t"<<student.name<<endl;
cout<<"Father`s Name:\t"<<student.f_name<<endl
cout<<"Address:\t"<<student.ad
cout<<"MISID:\t"<<student.misi
cout<<"Registration No#:\t"<<student.reg<<endl;
cout<<"Program:\t"<<student.pr
cout<<"Department:\t"<<student
cout<<"Semester:\t"<<student.s
cout<<"Shift:\t"<<student.shif
cout<<"Section:\t"<<student.se
cout<<"1st Subject:\t"<<student.sub1<<"\n
cout<<"2nd Subject:\t"<<student.sub2<<"\n
cout<<"3rd Subject:\t"<<student.sub3<<"\3
cout<<"4rth Subject:\t"<<student.sub4<<"\n
cout<<"5th Subject:\t"<<student.sub5<<"\n
cout<<"6th Subject:\t"<<student.sub6<<"\n
cout<<"TotalMarks:\t"<<total_m
file<<"Record:"<<endl;
file<<"Name :\t"<<student.name<<endl;
file<<"Father`s Name:\t"<<student.f_name<<endl
file<<"Address:\t"<<student.ad
file<<"MISID:\t"<<student.misi
file<<"Registration No#:\t"<<student.reg<<endl;
file<<"Program:\t"<<student.pr
file<<"Department:\t"<<student
file<<"Semester:\t"<<student.s
file<<"Shift:\t"<<student.shif
file<<"Section:\t"<<student.se
file<<"1st Subject:\t"<<student.sub1<<"\n
file<<"2nd Subject:\t"<<student.sub2<<"\n
file<<"3rd Subject:\t"<<student.sub3<<"\3
file<<"4rth Subject:\t"<<student.sub4<<"\n
file<<"5th Subject:\t"<<student.sub5<<"\n
file<<"6th Subject:\t"<<student.sub6<<"\n
file<<"TotalMarks:\t"<<total_m
cout<<"For Entering more Record for students Press y (yes), otherwise Press n (no)?"<<endl;
cin>>op;
}
while (op == 'Y' || op == 'y');
cout<<"Ok!!! GOOD BYE.....!!";
return 0;
}
No comments:
Post a Comment