Computer investigatory project

Embed Size (px)

Citation preview

  • 7/25/2019 Computer investigatory project

    1/34

    ABOUT C++ABOUT C++

    The C++ programming language was developed at

    AT&T Bell laboratories in the early 1980s by Barne

    !troustrup" #e $ound out %C la'(ing $or stimulating

    and de'ide to e)tend the language by adding$eatures" Barne !troustrup 'alled it %C with 'lasses

    originally" The name C++ was 'oined by *i'(

    as'itti where %++ is the C in'rement operator"

    ,ver sin'e its birth- C++ evolved to 'ope with

    problems en'ountered by users- and through

    dis'ussions at AT&T" The maor reason $or its su''essis the support $or .be't .riented /rogramming

    ../- whi'h is most near to real world situations"

    ABOUT THE PROJECTABOUT THE PROJECT

    This is a program based on student reports" This

    program helps us to do the basi' operations done in

    binary 2les i"e"

    CreateAppend!ear'hodi$y- and3elete

  • 7/25/2019 Computer investigatory project

    2/34

    student details" This also uses ../ $eatures li(e data

    abstra'tion and en'apsulation whi'h is implemented

    by the 'reation o$ obe't- based on a 'lass here

    4student" 5n this program- student re'ords mainly

    'onstitute the $ollowing data67

    *oll no6 o$ the studentamear(s out o$ 100 s'ored by the student in

    /hysi's- Chemistry- aths- ,nglish- and

    Computer !'ien'e"/er'entagerade

    This program mainly wor(s under three menus67

    ain menu6 This menu helps us to go to result

    menu or entry menu as per the entered 'hoi'e" *esult menu6 This menu displays the 'lass result-

    student result a''ording to the 'hoi'e given by

    the user" ,ntry menu6 This menu helps us to 'reate-

    display- sear'h- modi$y and delete student

    re'ords a''ording to the 'hoi'e entered by the

    user"

    This program also $a'ilitate us to get ba'( to the

    main menu whenever re:uired and also helps us to

    e)it the program" These $un'tions are 'ontrolled by

    the di;erent menus"

  • 7/25/2019 Computer investigatory project

    3/34

    #A*3!,3

    1"?eyboard7101 buttons@"onitor"C/>"/rinter75n(et

    "ouse7three button mouse

    55> *,D>5*,,T55> *,D>5*,,T

    1"/ersonal Computer/C@"1@8 B *A"

  • 7/25/2019 Computer investigatory project

    4/34

    GGprogram 'ode

    GGheader 2les used

    #include

    #include

    #include

    #include

    #include

    #include

    GG'lass de2nition

    class student

    {

    int rollno; GGto store rollno6o$student

    char name[50]; GGto store name o$ student

    int p_marks,c_marks,m_marks,e_marks,cs_marks; GGto store mar(s

    GGo$ di; sube'ts

  • 7/25/2019 Computer investigatory project

    5/34

    float per; GGto store per'entage

    char grade;GGto store grade

    oid calculate!"GGto 'al'ulate per'entage and assign grade

    {

    per!p_marks$c_marks$m_marks$e_marks$cs_marks"%5.0;

    if!per>&0"

    grade'(';

    else

    if!per*5"

    grade'+';

    elseif!per0"

    grade'-';

    else

    if!per0"

    grade'/';

    else

    grade'';

    1

    pu2lic3

  • 7/25/2019 Computer investigatory project

    6/34

    oid getdata!"

    GGto input all data members

    {

    coutrollno;

    cout

  • 7/25/2019 Computer investigatory project

    7/34

    cout

  • 7/25/2019 Computer investigatory project

    8/34

    {

    return rollno;

    11;

    GGglobal de'laration o$ variables

    fstream fp;

    student st;

    GG$un'tion de2nition to 'reate and append student details

    oid rite_student!"

    {

    fp.open!4=tudent.dat4,ios332inar9@ios33app@ios33out";

    char ans;

    do

    {

    st.getdata!";

    fp.rite!!charA")st,siBeof!st"";

    cout

  • 7/25/2019 Computer investigatory project

    9/34

    GG$un'tion de2nition to display details o$ all students

    oid displa9_all!"

    {

    clrscr!";

    cout

  • 7/25/2019 Computer investigatory project

    10/34

    hile!fp.read!!charA")st,siBeof!st"""

    {

    if!st.ret_rollno!"n"

    {

    clrscr!";

    st.shodata!";

    flag:;2reak;

    11

    fp.close!";

    if!flag0"

    cout

  • 7/25/2019 Computer investigatory project

    11/34

    hile!fp.read!!charA")st,siBeof!st""))found0"

    {

    if!st.ret_rollno!"no"

    {

    st.shodata!";

    cout

  • 7/25/2019 Computer investigatory project

    12/34

    clrscr!";

    int no;

    student st;

    cout

  • 7/25/2019 Computer investigatory project

    13/34

    {

    clrscr!";

    fp.open!4=tudent.dat4,ios332inar9@ios33in";

    if!Lfp"

    {

    cout

  • 7/25/2019 Computer investigatory project

    14/34

    1

    GG$un'tion de2nition $or result menu

    oid result!"

    {

    clrscr!";

    int ans;

    char ch;

    cout

  • 7/25/2019 Computer investigatory project

    15/34

    cout

  • 7/25/2019 Computer investigatory project

    16/34

    {

    case :3rite_student!";2reak;

    case P3displa9_all!";2reak;

    case 3search_student!";2reak;

    case 3modif9_student!";2reak;

    case 53delete_student!";2reak;

    case 32reak;

    1

    1

    GGmain program

    oid main!"

    {

    clrscr!";

    int ch;

    do

    {

    cout

  • 7/25/2019 Computer investigatory project

    17/34

    cin>>ch;

    sitch!ch"

    {

    case :3result!";

    2reak;

    case P3entr9_menu!";2reak;

    case 3eNit!0";

    1

    1hile!chL";

    getch!";

    1

    GGprogram ends

    GGHHHHHHH,3 .= /*.I,CTHHHHHHHHHH

    A5 ,> !C*,,

  • 7/25/2019 Computer investigatory project

    18/34

    ,T*J ,>7C*,AT5. A3A//,35 .= *,C.*3!

  • 7/25/2019 Computer investigatory project

    19/34

  • 7/25/2019 Computer investigatory project

    20/34

    35!/KAJ5 AKK *,C.*3!

  • 7/25/2019 Computer investigatory project

    21/34

    *,!>KT ,>

    CKA!! *,!>KT

  • 7/25/2019 Computer investigatory project

    22/34

    !T>3,T *,/.*T CA*3

  • 7/25/2019 Computer investigatory project

    23/34

  • 7/25/2019 Computer investigatory project

    24/34

  • 7/25/2019 Computer investigatory project

    25/34

    !,A*C#5 A /A*T5C>KA*

    *,C.*3

  • 7/25/2019 Computer investigatory project

    26/34

  • 7/25/2019 Computer investigatory project

    27/34

    .35=J5 A *,C.*3

    3,K,T5 A /A*T5C>KA*

    *,C.*3

  • 7/25/2019 Computer investigatory project

    28/34

    ,T,*5 BAC? T. A5 ,>

  • 7/25/2019 Computer investigatory project

    29/34

    CKA!! *,!>KT

  • 7/25/2019 Computer investigatory project

    30/34

    !T>3,T *,/.*T CA*3

  • 7/25/2019 Computer investigatory project

    31/34

  • 7/25/2019 Computer investigatory project

    32/34

    HHHHHHH,L5T =*.

    /*.*AHHHHHHH

  • 7/25/2019 Computer investigatory project

    33/34

    This program is mainly

    designed so as to input details o$ the student su'h

    as roll no- name and mar(s o$ sube'ts and to$un'tion the basi' operations done in binary 2les6

    sear'h- append- delete- and modi$y" This program

    also displays the student progress 'ard and also the

    'lass result in'luding their per'entage and grade"

    But this program allows us to

    input a limited number o$ entities li(e roll no- name-

  • 7/25/2019 Computer investigatory project

    34/34

    and mar(s" This program 'an be made more eM'ient

    by introdu'ing new menus and by in'luding more

    entities so as to store 'omplete details o$ the

    student whi'h will be use$ul in the near $uture"

    www.google.com

    Computer Science with C++ class

    !! "# Sumita Arora