WHAT'S NEW?
Loading...

Code for printing report card of a student




#include <iostream.h>
#include <stdio.h>
#include <process.h>

struct students
{
    int rollno;
    char name[30];
    char clas[30];
    int maths;
    int cs;
    int phy;
    int eng;
    int chem;
}s[20];

int main()
{
    int i, num, rollnum, ch, mark[30], grad[30];
    char a[100];

    start:

    cout<<"\t PROGRESS ANALYSIS";
    cout<<"\n\n 1. Insert Marks";
    cout<<"\n 2. Display Marks";
    cout<<"\n 3. Exit";

    cout<<"\n\n press 1,2,3 as per your need";
    cin>>ch;

    switch(ch)
    {
        case 1 :
        {
            cout<<"\n\n How many students mark you need to enter";
            cin>>num;
            for(i=0;i<num;++i)
            {
                cout<<"\n\nEnter the details of the "<<i+1<<" student";
                cout<<"\n\nEnter the rollno. of the student";
                cin>>s[i].rollno;
                cout<<"\n\nEnter the name of the student";
                gets(a);
                gets(s[i].name);
                cout<<"\n\nEnter the class of the student";
                gets(s[i].clas);
                cout<<"\n\nEnter the mark of English of the student";
                cin>>s[i].eng;
                cout<<"\n\nEnter the mark of Maths of the student";
                cin>>s[i].maths;
                cout<<"\n\nEnter the mark of Physics of the student";
                cin>>s[i].phy;
                cout<<"\n\nEnter the mark of Computer of the student";
                cin>>s[i].cs;
                cout<<"\n\nEnter the mark of Chemistry of the student";
                cin>>s[i].chem;
                mark[i]=s[i].eng+s[i].maths+s[i].phy+s[i].cs+s[i].chem;
                grad[i]=mark[i]/5;
            }
            goto start;
            break;
        }
        case 2 :
            cout<<"\n\n Enter the rollno. of student to see his detail";
            cin>>rollnum;
            for(i=0;i<num;++i)
            {
                if(s[i].rollno==rollnum)
                {
                    cout<<"\n\n the name of the student";
                    puts(s[i].name);
                    cout<<"\n\nthe class of the student";
                    puts(s[i].clas);
                    cout<<"\n\nthe mark in English of the student"
                        <<s[i].eng;
                    cout<<"\n\nthe mark in Maths of the student"
                        <<s[i].maths;
                    cout<<"\n\nthe mark in Physics of the student"
                        <<s[i].phy;
                    cout<<"\n\nthe mark in Computer of the student"
                        <<s[i].cs;
                    cout<<"\n\nthe mark in Chemistry of the student"
                        <<s[i].chem;
                    cout<<"\n\n\n Total mark"
                        <<mark[i];
                    cout<<"\n\n Grade of the student";

                    if(grad[i]>90)
                        cout<<"A1";
                    else if(grad[i]>80 && grad[i]<=90)
                        cout<<"A2";
                    else if(grad[i]>70 && grad[i]<=80)
                        cout<<"B1";
                    else if(grad[i]>60 && grad[i]<=70)
                        cout<<"B2";
                    else if(grad[i]>50 && grad[i]<=60)
                        cout<<"C1";
                    else if(grad[i]>40 && grad[i]<=50)
                        cout<<"C2";
                    else if(grad[i]>30 && grad[i]<=40)
                        cout<<"D1";
                    else if(grad[i]<=30 )
                        cout<<"fail";

                }
                else
                    cout<<"the details of the student is not insterted";
            }
            break;
            case 3 :
                exit(1);

    }

    return 0;
}

0 comments:

Post a Comment