Page 1 of 2 12 LastLast
Results 1 to 12 of 24

Thread: Student Data Base Software code of C++

  1. #1
    Hashmatnaqvi's Avatar
    Hashmatnaqvi is offline Senior Member+
    Last Online
    18th February 2016 @ 12:27 AM
    Join Date
    16 Jan 2012
    Location
    Islamabad
    Age
    23
    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. The Following 3 Users Say Thank You to Hashmatnaqvi For This Useful Post:

    Haseeb Alamgir (10th May 2014), imraan340 (11th May 2014), Waseemkhan13 (27th August 2014)

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

    Default

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

  4. #3
    Haseeb Alamgir's Avatar
    Haseeb Alamgir is offline Advance Member+
    Last Online
    19th April 2015 @ 01:47 AM
    Join Date
    09 Apr 2009
    Location
    کر&
    Age
    21
    Gender
    Male
    Posts
    11,628
    Threads
    187
    Credits
    0
    Thanked
    1348

    Default

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

  5. #4
    imraan340's Avatar
    imraan340 is offline Senior Member+
    Last Online
    14th June 2017 @ 08:11 PM
    Join Date
    28 Feb 2014
    Location
    MULTAN
    Age
    29
    Gender
    Male
    Posts
    264
    Threads
    3
    Credits
    200
    Thanked
    10

    Default

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

  6. #5
    Hashmatnaqvi's Avatar
    Hashmatnaqvi is offline Senior Member+
    Last Online
    18th February 2016 @ 12:27 AM
    Join Date
    16 Jan 2012
    Location
    Islamabad
    Age
    23
    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?

  7. #6
    WAQAS1412's Avatar
    WAQAS1412 is offline Advance Member
    Last Online
    5th September 2017 @ 11:57 AM
    Join Date
    01 Apr 2013
    Location
    Islamabad
    Age
    19
    Gender
    Male
    Posts
    8,617
    Threads
    159
    Credits
    13
    Thanked
    622

    Default

    JazakAllah Nice Sharing


  8. #7
    awara_panche's Avatar
    awara_panche is offline Advance Member
    Last Online
    15th October 2017 @ 05:35 PM
    Join Date
    27 Feb 2014
    Age
    23
    Gender
    Male
    Posts
    1,522
    Threads
    137
    Credits
    389
    Thanked
    140

    Default

    bhot bura nae nice thread h

  9. #8
    Qasim-'s Avatar
    Qasim- is offline Senior Member+
    Last Online
    17th August 2016 @ 02:02 PM
    Join Date
    26 Nov 2013
    Location
    Gujrat
    Age
    22
    Gender
    Male
    Posts
    175
    Threads
    19
    Credits
    287
    Thanked
    4

    Default

    Mind Blowing Copy Paste Good Work

  10. #9
    Hashmatnaqvi's Avatar
    Hashmatnaqvi is offline Senior Member+
    Last Online
    18th February 2016 @ 12:27 AM
    Join Date
    16 Jan 2012
    Location
    Islamabad
    Age
    23
    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

  11. #10
    IshqBeparwah's Avatar
    IshqBeparwah is offline Senior Member+
    Last Online
    2nd June 2017 @ 07:20 PM
    Join Date
    08 Nov 2013
    Location
    Kheyaloon Main
    Gender
    Male
    Posts
    2,146
    Threads
    72
    Credits
    506
    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....!!!!

  12. #11
    MUZAFAR_ALI is offline Senior Member+
    Last Online
    Today @ 11:08 AM
    Join Date
    25 Jan 2012
    Location
    QUETTA
    Gender
    Male
    Posts
    199
    Threads
    2
    Credits
    11
    Thanked
    12

    Default

    Nice

  13. #12
    Hashmatnaqvi's Avatar
    Hashmatnaqvi is offline Senior Member+
    Last Online
    18th February 2016 @ 12:27 AM
    Join Date
    16 Jan 2012
    Location
    Islamabad
    Age
    23
    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 2 12 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
  •