Page 95 - C++
P. 95
for(int K=1;K<=B;K++) cout<<A*k;
cout<<endl;
}
void Print(char T, int N) // Function[IV]
{
for (int K=1;k<=N;K++) cout<<T;
cout<<endl;
}
void main( )
{
int U=9,V=4,W=3;
char C =‟@‟;
Print(C,V);
Print(U,W);
}
(c) Define a class candidate in C++ with following Description: [4]
Private Members
• A data member RNo (Registration Number) of type long
• A data member Name of type string
• A data member Score of type float
• A data member Remark of type string
• A member function AssignRem( ) to assign Remarks as per the Score obtained by a candidate. Score
range and the respective Remarks are shown as follows:
Score Remarks
>=50 Selected
less than 50 Not selected
Public members
• A function Enter( ) to allow user to enter values for RNo, Name, Score & call function AssignRem()
to assign the remarks.
• A function Display( ) to allow user to view the content of all the data members.
(d) Answer the question (i) to (iv) based on the following: [4]
class Student
{
int Rno;