OOCP1_4

//HiTech Banda //bit.ly/hitechbanda #include <iostream.h> #include <conio.h> class student { private: int roll,marks[5],total; char name[20]; public: void get() { cout<<"\nEnter roll no. : "; cin>>roll; cout<<"Enter name : "; cin>>name; cout<<"\nEnter marks of 5 subjects :\n"; for(int a=0;a<5;a++) cin>>marks[a]; } void display() { clrscr(); cout<<"\nRoll No. : "<<roll; cout<<"\nName : "<<name; cout<<"\nMarks :\n"; for(int a=0;a<5;a++) cout<<marks[a]<<endl; } }; void main() { clrscr(); student s; s.get(); s.display(); getch(); }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.