USING CHARACTER ARRAY GENERATE MARKSHEET

USING CHARACTER ARRAY GENERATE MARKSHEET

/*
Write a program to generate marksheet
assuming that
the following information can be read
from keyboard.
a. Student name, b. roll number. c, registration number,
d. total marks, e. division/grade
*/

#include <iostream>
#include <iomanip>

class marksheet{
int tmarks, roll;
char name[20], rgno[20], div[20];
public:
    void uinput()
    {
        std::cout<<"Enter Values in Following Fields ";
        std::cout<<std::endl<<"NAME: "; std::cin>>name;
        std::cout<<"ROLL: "; std::cin>>roll;
        std::cout<<"REG. NO.: "; std::cin>>rgno;
        std::cout<<"TOTAL MARKS: "; std::cin>>tmarks;
        std::cout<<"DIVISION: "; std::cin>>div;
        std::cout<<"Successful."<<std::endl;
    }

    void uresult()
    {
        std::cout<<std::setw(10)<<"Student Name"<<std::setw(10)<<"Roll No"<<std::setw(10)<<"Reg. No."<<std::setw(10)<<"Total Marks"<<std::setw(10)<<"Division"<<std::endl;
        std::cout<<std::setw(10)<<name<<std::setw(10)<<roll<<std::setw(10)<<rgno<<std::setw(10)<<tmarks<<std::setw(10)<<div<<std::endl;
    }

};

int main(){

marksheet m;
m.uinput();
m.uresult();
}


/*
Output:

Enter Values in Following Fields
NAME: SAIF
ROLL: 15    
REG. NO.: 017
TOTAL MARKS: 987
DIVISION: 1
Successful.
Student Name   Roll No  Reg. No.Total Marks  Division
      SAIF        15       017       987         1


*/

 

Comments

Popular posts from this blog

SAME NAME IN CLASS METHOD AND CONSTRUCTOR

PALINDROME NUMBER

FIBONACCI SERIES