You are on page 1of 2

Q1.Rewrite the following program after removing the syntactical errors.

Underline the each correction


#include iostream.h
class Pay
{ int rate, noofhours;
PUBLIC:
void Read()
{
cin>>rate>>noofhours;
int value=rate*noofhours;
}
void Show()
{
cout<<rate<< noofhours<<value;
}
};
void main()
{
Pay P;
P.read();
P.show();
}
Q2. Find the output of the following
#include <iostream.h>
struct Play
{
int score, bonus;
};
void Read(Play &P, int N=10)
{
P.score++;
P.bonous+=N;
}
void main()
{
Pay P={10,15};
Read(P,20);
cout<<P.bonus<<”:”<<P.score<<endl;
Read(P);
cout<<P.bonus<<”:”<<P.score<<endl;
Read(P,15);
cout<<P.bonus<<”:”<<P.score<<endl;
}
Q3. Declare a structure Item

Itemcod Description Category quantity rate


e
Type manufacturer Supplier Quantity Quantity purchasecost mrp
Of name sold bought
product
Q4. Find the output of the following
#include
#include
void encrypt(char T[])
{
for(int I=0;T[I]!=’\0’;I+=2)
{
if (T[I] ==’E’ T[I]==’C’)
T[I]=’#’;
else if (islower(T[I])
T[I]=toupper(T[I]);
else T[I]=’@’;
}
}
void main()
{
char text[]=”CompuTEr SciencE”;
encrypt(text);
cout<<text<<endl;
}