Page 1 of 3 123 LastLast
Results 1 to 12 of 25

Thread: Student Data Base Software code of C++

  1. #1
    Hashmatnaqvi's Avatar
    Hashmatnaqvi is offline Senior Member+
    Last Online
    18th February 2016 @ 01:27 AM
    Join Date
    16 Jan 2012
    Location
    Islamabad
    Age
    30
    Gender
    Male
    Posts
    639
    Threads
    55
    Credits
    0
    Thanked
    105

    Default Student Data Base Software code of C++

    Kesay hain ap sub umeed hai theak hon gy aj kafi dino bad sharing ker rha hu umeed hai ap ko passand aey gi.
    dosto main students ka database rakhny k leay ek software bnaya socha ap k sath bhi share kru. ager passand aey to apni raey zrur dena.

    CODE
    #include<iostream>
    #include<fstream>
    #include<conio.h>
    using namespace std;
    class student
    {
    private:
    int id;
    char name[30];
    char age[20];
    char address[150];
    char phone[20];
    char qual[100];
    char db[100];
    public:
    void getdata()
    {
    cout<<"Enter Student ID: ";
    cin>>id;
    cin.ignore();
    cout<<"\nEnter Student Name: ";
    gets_s(name);
    cin.ignore();
    cout<<"Enter Student Address: ";
    gets_s(address);
    cin.ignore();
    cout<<"Enter Student Ph#: ";
    gets_s(phone);
    cin.ignore();
    cout<<"Enter Student Age: ";
    gets_s(age);
    cin.ignore();
    cout<<"Enter Student Qualification: ";
    gets_s(qual);
    cin.ignore();
    cout<<"Enter Student Date Of Birth: ";
    gets_s(db);
    cin.ignore();
    }
    void showdata()
    {
    cout<<"\nID: "<<id<<endl;
    cout<<"\nName: "<<name<<endl;
    cout<<"\nAddress :"<<address<<endl;
    cout<<"\nPh#: "<<phone<<endl;
    cout<<"\nAge: "<<age<<endl;
    cout<<"\nQualification: "<<qual<<endl;
    cout<<"\nDate Of Birth: "<<db<<endl;
    cout<<""<<endl;
    }
    int rtrnid()
    {
    return id;
    }
    };
    void write_data()
    {
    student a;
    ofstream fout;
    fout.open("d:\\student.dat",ios::binary|ios::app);
    a.getdata();
    fout.write((char*)&a,sizeof(a));
    fout.close();
    }
    void search (int n)
    {
    student a;
    ifstream fin;
    fin.open("D:\\student.dat",ios::binary);
    while(fin.read((char*)&a,sizeof(a)))
    {
    if(a.rtrnid()==n)
    {
    cout<<"\nRecord For ID "<<n<<" Is Given Below\n ";
    a.showdata();
    break;
    }
    }
    fin.close();
    }
    void del(int n)
    {
    student a;
    ifstream fin;
    fin.open("D:\\student.dat",ios::in|ios::binary);
    ofstream fout;
    fout.open("D:\\temp.dat",ios:ut|ios::binary);
    while(fin.read((char*)&a,sizeof(a)))
    {
    if(a.rtrnid()!=n)
    {
    fout.write((char*)&a,sizeof(a));
    break;
    }
    fin.read((char*)&a,sizeof(a));
    }
    fin.close();
    fout.close();
    remove("D:\\student.dat");
    rename("D:\\temp.dat","D:\\student.dat");
    }
    void modify(int n)
    {
    fstream fout;
    student a;
    int found=0,cnt=0;
    fout.open("d:\\student.dat",ios::ate|ios::in|ios:ut|ios::binary);
    fout.seekg(0,ios::beg);
    while( fout.read((char*)&a,sizeof(a)))
    {cnt++;
    if(a.rtrnid()==n)
    {
    found=1;
    a.showdata();break;
    }
    }
    if(found)
    {
    cout<<"\nModify Above Record: "<<endl;

    fout.seekp((cnt-1)* sizeof(a));
    a.getdata();
    fout.write((char*)&a,sizeof(a));
    cout<<"\nRecord Has Been Successfully Updated\n";

    }
    else cout<<"Record Not found";
    fout.close();
    }
    void main()
    {
    int opt;
    while(1)
    {
    system("CLS");
    cout<<"====================="<<endl;
    cout<<": Students Database :"<<endl;
    cout<<"====================="<<endl;
    cout<<""<<endl;
    cout<<"<<<<< MAIN MENU >>>>>"<<endl;
    cout<<""<<endl;
    cout<<"1.Enter New Student Data"<<endl;
    cout<<"2.Search Student Data"<<endl;
    cout<<"3.Delete Student Data"<<endl;
    cout<<"4.Modify Student Data"<<endl;
    cout<<"0.Exit"<<endl;
    cout<<"Enter your Option : ";
    cin>>opt;
    switch(opt)
    {
    case 1:
    {
    system("CLS");
    cout<<"<<< NEW STUDENT ENTRY >>>"<<endl;
    cout<<""<<endl;
    write_data();
    cout<<"\nYour Data Has Been Recoded\n";
    cout<<"\nPress Any Key For Main Menu";
    getch();
    break;
    }
    case 2:
    {
    system("CLS");
    cout<<"<<< STUDNET SEARCH >>>"<<endl;
    cout<<""<<endl;
    int n;
    cout<<"Enter Student ID to Search Record: ";
    cin>>n;
    search(n);
    cout<<"\nPress Any Key For Main Menu";
    getch();
    break;
    }
    case 3:
    {
    system("CLS");
    cout<<"DELETE STUDENT RECORD"<<endl;
    cout<<""<<endl;
    int b;
    cout<<"Enter Student ID You Want To Delete: "<<endl;
    cin>>b;
    del(b);
    cout<<"\nRecord of "<<b<<" Has been Deleted"<<endl;
    cout<<"\nPress Any Key For Main Menu";
    getch();
    break;
    }
    case 4:
    {
    system("CLS");
    cout<<"MODIFY STUDENT RECORD"<<endl;
    cout<<""<<endl;
    int b;
    cout<<"Enter Student ID To Modify RECORD: "<<endl;
    cin>>b;
    modify(b);
    cout<<"\nPress Any Key For Main Menu";
    getch();
    break;
    }
    case 0:
    {
    exit(0);
    }
    default:
    {
    cout<<""<<endl;
    cout<<"Invalid Input"<<endl;
    cout<<""<<endl;
    }
    }
    }
    system ("pause");
    }
    Shadow xXx

  2. #2
    DIGITAL_PAINDU is offline Senior Member+
    Last Online
    20th April 2015 @ 09:57 PM
    Join Date
    11 Mar 2009
    Age
    39
    Posts
    580
    Threads
    38
    Credits
    965
    Thanked
    34

    Default

    thnx , kya yeh User Interface k saath share kr sakty hn?

  3. #3
    Haseeb Alamgir's Avatar
    Haseeb Alamgir is offline Super Moderator
    Last Online
    Yesterday @ 02:07 PM
    Join Date
    09 Apr 2009
    Location
    KARACHI&
    Gender
    Male
    Posts
    19,624
    Threads
    429
    Credits
    41,943
    Thanked
    1813

    Default

    نقوی برادر بہت ہی اچھے اور آسان طریقے سے آپ نے
    ڈیٹا بیس تیار کی ہے
    مجھے یہ زبان نہیں آتی پھر بھی سارا طریقہ کار بہتر انداز میں سمجھ آ رہا ہے
    جزاک اللہ
    ہمارے ساتھ شئیر کرنے کا بہت شکریہ

  4. #4
    imraan340's Avatar
    imraan340 is offline Senior Member+
    Last Online
    20th February 2022 @ 03:00 PM
    Join Date
    28 Feb 2014
    Location
    MULTAN
    Age
    36
    Gender
    Male
    Posts
    266
    Threads
    3
    Credits
    257
    Thanked
    10

    Default

    aako kis tarah thank's kaho lafz nahi hein phir bhi

  5. #5
    Hashmatnaqvi's Avatar
    Hashmatnaqvi is offline Senior Member+
    Last Online
    18th February 2016 @ 01:27 AM
    Join Date
    16 Jan 2012
    Location
    Islamabad
    Age
    30
    Gender
    Male
    Posts
    639
    Threads
    55
    Credits
    0
    Thanked
    105

    Default Thnx to All of u

    Quote Haseeb Alamgir said: View Post
    نقوی برادر بہت ہی اچھے اور آسان طریقے سے آپ نے
    ڈیٹا بیس تیار کی ہے
    مجھے یہ زبان نہیں آتی پھر بھی سارا طریقہ کار بہتر انداز میں سمجھ آ رہا ہے
    جزاک اللہ
    ہمارے ساتھ شئیر کرنے کا بہت شکریہ
    Quote imraan340 said: View Post
    aako kis tarah thank's kaho lafz nahi hein phir bhi
    Quote DIGITAL_PAINDU said: View Post
    thnx , kya yeh User Interface k saath share kr sakty hn?

  6. #6
    WAQAS1412's Avatar
    WAQAS1412 is offline Senior Member+
    Last Online
    20th January 2021 @ 02:42 PM
    Join Date
    01 Apr 2013
    Location
    Islamabad
    Age
    26
    Gender
    Male
    Posts
    8,617
    Threads
    160
    Credits
    83
    Thanked
    622

    Default

    JazakAllah Nice Sharing


  7. #7
    awara_panche's Avatar
    awara_panche is offline Advance Member
    Last Online
    24th October 2022 @ 08:28 AM
    Join Date
    27 Feb 2014
    Age
    30
    Gender
    Male
    Posts
    1,561
    Threads
    144
    Credits
    -1,275
    Thanked
    140

    Default

    bhot bura nae nice thread h

  8. #8
    Qasim-'s Avatar
    Qasim- is offline Senior Member+
    Last Online
    16th December 2019 @ 06:45 PM
    Join Date
    26 Nov 2013
    Location
    Gujrat
    Age
    29
    Gender
    Male
    Posts
    175
    Threads
    19
    Credits
    1,076
    Thanked
    4

    Default

    Mind Blowing Copy Paste Good Work

  9. #9
    Hashmatnaqvi's Avatar
    Hashmatnaqvi is offline Senior Member+
    Last Online
    18th February 2016 @ 01:27 AM
    Join Date
    16 Jan 2012
    Location
    Islamabad
    Age
    30
    Gender
    Male
    Posts
    639
    Threads
    55
    Credits
    0
    Thanked
    105

    Default

    Quote Qasim- said: View Post
    Mind Blowing Copy Paste Good Work
    dear not copy paste its my own work

  10. #10
    IshqBeparwah's Avatar
    IshqBeparwah is offline Advance Member
    Last Online
    13th May 2020 @ 06:36 PM
    Join Date
    08 Nov 2013
    Location
    Kheyaloon Main
    Gender
    Male
    Posts
    2,148
    Threads
    73
    Credits
    1,375
    Thanked
    187

    Default

    Vicaul basic 6 k bare me kuch bata sakte ho kya.?
    Ae Dil,,,, Tu Kyun Khush Ho Raha Hai,
    Pagal Sirf Saal Badla Hai,,,, Log Nahi....!!!!

  11. #11
    MUZAFAR_ALI is offline Senior Member+
    Last Online
    27th July 2019 @ 08:35 PM
    Join Date
    25 Jan 2012
    Location
    QUETTA
    Gender
    Male
    Posts
    199
    Threads
    2
    Credits
    12
    Thanked
    12

    Default

    Nice

  12. #12
    Hashmatnaqvi's Avatar
    Hashmatnaqvi is offline Senior Member+
    Last Online
    18th February 2016 @ 01:27 AM
    Join Date
    16 Jan 2012
    Location
    Islamabad
    Age
    30
    Gender
    Male
    Posts
    639
    Threads
    55
    Credits
    0
    Thanked
    105

    Default

    Quote IshqBeparwah said: View Post
    Vicaul basic 6 k bare me kuch bata sakte ho kya.?
    Nai bro mjy sirf c++ ka pta hai sorry

Page 1 of 3 123 LastLast

Similar Threads

  1. gta sa mod
    By zt4096 in forum Help/Request (PC Games)
    Replies: 5
    Last Post: 30th May 2013, 02:25 PM
  2. Nokia Mobile Sets Secret Codes
    By majid786 in forum General Mobile Discussion
    Replies: 16
    Last Post: 24th March 2012, 03:48 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •