Rewrite the following program after removing the syntactical error(s), if any.

Q-1) Rewrite the correct code in Comment Section.

#include <iostream.h>

const int Size 5;
void main( )
{
   int Array [Size] ;
   Array = { 50, 40, 30, 20, 10 } ;
   for (Ctr = 0 ; Ctr < Size; Ctr++)
   cout>>Array [Ctr];
}


Q-2) Rewrite the correct code in Comment Section.


#include (iostream.h)

void main( )

   int X[ ] = { 60,50,30,40}, Y; Count = 4;
   cin >> Y ;
   for ( I = Count – 1 ; I >= 0, I - -)
   switch( I )
   {
      case 0 :
      case 2 : cout<<Y * X [I ] << endl; break;
      case 1 :
      case 3 : cout >> Y + X [I] ;
   }
}

Q-3) Rewrite the correct code in Comment Section.


#include <iostream.h>

void main ( )
{
   int P[ ]={90,10,24,15}:Q, Number = 4 ; Q = 9;
   for [ int I = Number – 1 ; I >= 0, I--]
      Switch ( I )
      {
         case 0 :
         case 3 : cout >> P [ I ] * Q << endl ; break ;
         case 1 :
         case 2 : cout << P [ I ] + Q ;
      }
}

Q-4) Rewrite the correct code in Comment Section.


#include<iostream.h>
Class Item
{
long IId, Qty;
public:
void Purchase { cin>>IId>>Qty;}
void Sale()
{
cout<<setw(5)<<IId<<”Old:”<< Qty<<endl;
cout<< “New :”<<Qty<<endl;
}   
};

void main()

{
Item I;
Purchase();
I.Sale()

}

Q-5) Rewrite the correct code in Comment Section.


#include<iostream.h>

void main( )

F = 10, S = 20;
test(F;S);
test(S);
}
void test(int x, int y = 20)

x=x+y;
count<<x>>y;

}


Q-6) Rewrite the correct code in Comment Section.


#include “iostream.h”
Class MEMBER

int Mno;
float Fees;
PUBLIC:
void Register ( ) 
{
cin>>Mno>>Fees;
}
void Display( ) 
{
cout<<Mno<<" : "<<Fees<<endl;
}
};
void main()

MEMBER delete;
Register();
delete.Display();

}

Q-7) Rewrite the correct code in Comment Section.


include<iostream.h>
class FLIGHT

Long FlightCode;
Char Description[25];
public
void addInfo()

cin>>FlightCode; 
gets(Description);
}
void showInfo()

cout<<FlightCode<<”:”<<Description<<endl;
}
};

void main( )


FLIGHT F;
addInfo.F();
showInfo.F;

}







No comments

Post your comments

Powered by Blogger.