Score Board Project in c++ language in hindi

cricket score sheet mini project in c++ source code , Score Board Project in c++ language in hindi :- इस प्रोजेक्ट मे , किसी class के student के मार्क्स के हिसाब से score board को बनाया जाता है |Explanation
1. सबसे पहले class student को डेफिन किया जाता है | जिसमे दो तरह के member होते है :-
private member :
इस क्लास मे ,

int Rollnumber : ये student के roll number को hold करता है |

char name[50] : ये student के नाम को hold करता है |

PHISICS_MARKS : ये student के physics subject के मार्क्स को hold करता है | 
CHEMISTRY_MARKS: ये student के chemistry subject के मार्क्स को hold करता है |
MATHS_MARKS : ये student के math subject के मार्क्स को hold करता है |
ENGLISH_MARKS :ये student के English subject के मार्क्स को hold करता है |
HINDI_MARKS : ये student के Hindi subject के मार्क्स को hold करता है | double percentage : ये student द्वारा प्राप्त किये गये percentage को hold करता है |

इसके अलावा इस class मे , निन्म public function है जिससे प्रोजेक्ट के मुख्य operation को perform किया जाता है |
calculate() : इस function का use average को calculate करने एक लिए किया जाता है |
getdata() : इस function का use , student से data को input करने एक लिए किया जाता है |
showdata() : इस function का use data को show करने के लिए किया जाता है |

void class_result(): इस function का use file मे से data को read करके screen पर print करने के लोइए use किया जाता है |     

Also read : Write a program to write a content in file in hindi

void result() : इस function का use result के menu को print करने के लिए किया जाता है |                


इस प्रोग्राम मे file handling को use किया गया है जिससे हम पहले discuss कर चुके है |

#include<iostream>
#include<conio>
#include<string>
void main()
class student {
Private :

int Rollnumber;

char name[50];

int PHISICS_MARKS , CHEMISTRY_MARKS, MATHS_MARKS ,
ENGLISH_MARKS , HINDI_MARKS ;

double percentage;

char grade;

void calculate();                //function
to calculate grade

public:

void getdata();                  //function
to accept data from user

void showdata() const;  //function to show data on screen

void show_tabular() const;

int retRollnumber() const;

#include<iostream>

#include<fstream>

#include<iomanip>

using namespace std;

// class definition

class student_data

{

int Rollnumber;

char name[50];

int PHISICS_MARKS , CHEMISTRY_MARKS, MATHS_MARKS ,
ENGLISH_MARKS , HINDI_MARKS ;

double percentage;

char grade;

void calculate();                //function
to calculate grade

public:

void getdata();                  //function
to accept data from user

void showdata() const;  //function to show data on screen

void show_tabular() const;

int retRollnumber() const;

}; //class ends here

void student_data ::calculate()

{

percentage=(PHISICS_MARKS
+CHEMISTRY_MARKS+MATHS_MARKS +ENGLISH_MARKS +HINDI_MARKS )/5.0;

if(percentage>=60)

grade=’A’;

else if(percentage>=50)

grade=’B’;

else if(percentage>=33)

grade=’C’;

else

grade=’F’;

}

void student_data ::getdata()

{

cout<<“nEnter Roll number : “;

cin>>Rollnumber;

cout<<“nnEnter Name : “;

cin.ignore();

cin.getline(name,50);

cout<<“nEnter marks (Physics) :  “;

cin>>PHISICS_MARKS ;

cout<<“nEnter marks (Chemistry) :
“;

cin>>CHEMISTRY_MARKS;

cout<<“nEnter marks (Math) : “;

cin>>MATHS_MARKS ;

cout<<“Enter marks (English) : “;

cin>>ENGLISH_MARKS ;

cout<<“nEnter marks (Hindi) : “;

cin>>HINDI_MARKS ;

calculate();

}

void student_data ::showdata() const

{

cout<<“nRoll number of
student_data  : “<<Rollnumber;

cout<<“nName of student_data  : “<<name;

cout<<“nMarks in Physics :
“<<PHISICS_MARKS ;

cout<<“nMarks in Chemistry :
“<<CHEMISTRY_MARKS;

cout<<“nMarks in Maths :
“<<MATHS_MARKS ;

cout<<“nMarks in English :
“<<ENGLISH_MARKS ;

cout<<“nMarks in Computer Science
:”<<HINDI_MARKS ;

cout<<“npercentagecentage of
student_data  is  :”<<percentage;

cout<<“nGrade of student_data  is :”<<grade;

}

void student_data ::show_tabular() const

{

cout<<Rollnumber<<setw(6)<<”
“<<name<<setw(10)<<PHISICS_MARKS
<<setw(4)<<CHEMISTRY_MARKS<<setw(4)<<MATHS_MARKS
<<setw(4)

<<ENGLISH_MARKS
<<setw(4)<<HINDI_MARKS
<<setw(8)<<percentage<<setw(6)<<grade<<endl;

}

int
student_data ::retRollnumber() const

{

return Rollnumber;

}

void write_student_data ();        //write the DATA in binary file

void display_all();             //read all DATAs from binary file

void display_sp(int);       //accept Rollnumber and read DATA from binary file

void modify_student_data (int);               //accept Rollnumber and update
DATA of binary file

void delete_student_data (int);                //accept Rollnumber and delete
selected DATAs from binary file

void class_result();          //display all DATAs in tabular format from binary file

void result();                      //display
result menu

void intro();                        //display
welcome screen

void entry_menu();        //display
entry menu on screen

int main()

{

char ch;

cout.setf(ios::fixed|ios::showpoint);

cout<<setprecision(2); // program outputs
decimal number to two decimal places

intro();

do

{

system(“cls”);

cout<<“nnntMAIN MENU”;

cout<<“nnt01. RESULT MENU”;

cout<<“nnt02. ENTRY/EDIT MENU”;

cout<<“nnt03. EXIT”;

cout<<“nntPlease Select Your Option
(1-3) “;

cin>>ch;

switch(ch)

{

case ‘1’: result();

break;

case ‘2’: entry_menu();

break;

case ‘3’:

break;

default :cout<<“a”;

}

}while(ch!=’3′);

return 0;

}

void write_student_data ()

{

student_data
st;

ofstream outFile;

outFile.open(“student_data
.dat”,ios::binary|ios::app);

s.getdata();

outFile.write(reinterpret_cast<char *>
(&st), sizeof(student_data ));

outFile.close();

cout<<“nnstudent_data  DATA Has Been Created “;

cin.ignore();

cin.get();

}

void display_all()

{

student_data
s;

ifstream inFile;

inFile.open(“student_data
.dat”,ios::binary);

if(!inFile)

{

cout<<“File could not be open right now
So Press any Key “;

cin.ignore();

cin.get();

return;

}

cout<<“nnnttDISPLAY ALL DATA
!!!nn”;

while(inFile.read(reinterpret_cast<char *>
(&s), sizeof(student_data )))

{

s.showdata();

}

inFile.close();

cin.ignore();

cin.get();

}

void display_student(int n)

{

student_data
st;

ifstream inFile;

inFile.open(“student_data
.dat”,ios::binary);

if(!inFile)

{

cout<<“File could not be open right now
So Press any Key “;

cin.ignore();

cin.get();

return;

}

bool flag=false;

while(inFile.read(reinterpret_cast<char *>
(&st), sizeof(student_data )))

{

if(s.retRollnumber()==n)

{

s.showdata();

flag=true;

}

}

inFile.close();

if(flag==false)

cout<<“nnDATA not exist”;

cin.ignore();

cin.get();

}

void modify_student_data (int n)

{

bool found=false;

student_data
st;

fstream File;

File.open(“student_data
.dat”,ios::binary|ios::in|ios::out);

if(!File)

{

cout<<“File could not be open right now
So Press any Key”;

cin.ignore();

cin.get();

return;

}

while(!File.eof() && found==false)

{

File.read(reinterpret_cast<char *>
(&st), sizeof(student_data ));

if(s.retRollnumber()==n)

{

s.showdata();

cout<<“nnPlease Enter The New Details
of student_data “<<endl;

s.getdata();

int pos=(-1)*static_cast<int>(sizeof(st));

File.seekp(pos,ios::cur);

File.write(reinterpret_cast<char *>
(&st), sizeof(student_data ));

cout<<“nnt DATA Updated”;

found=true;

}

}

File.close();

if(found==false)

cout<<“nn DATA Not Found “;

cin.ignore();

cin.get();

}

void delete_student_data (int n)

{

student_data
st;

ifstream inFile;

inFile.open(“student_data
.dat”,ios::binary);

if(!inFile)

{

cout<<“File could not be open right now
So Press any Key “;

cin.ignore();

cin.get();

return;

}

ofstream outFile;

outFile.open(“Temp.dat”,ios::out);

inFile.seekg(0,ios::beg);

while(inFile.read(reinterpret_cast<char *>
(&st), sizeof(student_data )))

{

if(s.retRollnumber()!=n)

{

outFile.write(reinterpret_cast<char *>
(&st), sizeof(student_data ));

}

}

outFile.close();

inFile.close();

remove(“student_data .dat”);

rename(“Temp.dat”,”student_data
.dat”);

cout<<“nntDATA Deleted ..”;

cin.ignore();

cin.get();

}

void class_result()

{

student_data
st;

ifstream inFile;

inFile.open(“student_data
.dat”,ios::binary);

if(!inFile)

{

cout<<“File could not be open !! Press
any Key…”;

cin.ignore();

cin.get();

return;

}

cout<<“nnttALL student_data S
RESULT nn”;

while(inFile.read(reinterpret_cast<char *>
(&st), sizeof(student_data )))

{

s.show_tabular();

}

cin.ignore();

cin.get();

inFile.close();

}

void result()

{

char ch;

int rno;

system(“cls”);

cout<<“nnntRESULT MENU”;

cout<<“nnnt1. Class Result”;

cout<<“nnt2. student_data  Report Card”;

cout<<“nnt3. Back to Main
Menu”;

cout<<“nnntEnter Choice (1/2/3)?
“;

cin>>ch;

system(“cls”);

switch(ch)

{

case ‘1’ :               class_result();
break;

case ‘2’ :               cout<<“nntEnter
Roll Number Of student_data  : “;
cin>>rno;

display_sp(rno); break;

case ‘3’ :               break;

default:                cout<<“a”;

}

}

void intro()

{

cout<<“nnntt  student_data “;

cout<<“nnttREPORT CARD”;

cout<<“nntt  PROJECT”;

cout<<“nnntMADE BY : SULABH
AGRAWAL”;

cout<<“ntSCHOOL : CAMBRIDGE
SCHOOL”;

cin.get();

}

void entry_menu()

{

char ch;

int num;

system(“cls”);

cout<<“nnntENTRY MENU”;

cout<<“nntC.CREATE student_data  DATA “;

cout<<“nntV.DISPLAY ALL student_data
S DATA “;

cout<<“nntS.SEARCH student_data  DATA “;

cout<<“nntM.MODIFY student_data  DATA”;

cout<<“nntD.DELETE student_data  DATA”;

cout<<“nntB.BACK TO MAIN MENU”;

cout<<“nntPlease Enter Your Choice :
“;

cin>>ch;

system(“cls”);

switch(ch)

{

case ‘C’:                write_student_data
();

break;

case ‘V’:                display_all();

break;

case ‘D’:                cout<<“nntPlease
Enter The roll number for display “;

cin>>num;

display_sp(num);

break;

case ‘M’:              cout<<“nntPlease
Enter The roll number for modify “;

cin>>num;

modify_student_data (num);

break;

case ‘D’:                cout<<“nntPlease
Enter The roll number for delete “;

cin>>num;

delete_student_data (num);

break;

case ‘B’:               

break;

default:               

cout<<“a”;

entry_menu();

}

}

हम आशा करते है कि यह नोट्स आपकी स्टडी में उपयोगी साबित हुए होंगे | अगर आप लोगो को इससे रिलेटेड कोई भी किसी भी प्रकार का डॉउट हो तो कमेंट बॉक्स में कमेंट करके पूंछ सकते है |
आप इन्हे अपने Classmates & Friends के साथ शेयर कर सकते है |

Leave a Comment

Your email address will not be published.