Write a program that takes in a letterclass ID of a ship and display the equivalent string class description of the given ID. Use the table below.

 

Write a program that takes in a letterclass ID of a ship and display the equivalent string class description of the given ID. Use the table below.  

Class ID Ship Class B or b BattleShip C or c Cruiser D or d Destroyer F or f Frigate






OURSHOPKEEPER









#include <iostream>
using namespace std;

int main()
{
    int T;
    char abcdf;
    cin >> T;
    while (T--)
    {
        cin >> a;
        if (a == 'b' || a == 'B')
            cout << "BattleShip";

        else if (a == 'c' || a == 'C')
            cout << "Cruiser";

        else if (a == 'd' || a == 'D')
            cout << "Destroyer";

        else if (a == 'f' || a == 'F')
            cout << "Frigate";
    }
    
}






    


Click on the above button to download the code.



Post a Comment

If you have furthur QUERIES please let us know

Previous Post Next Post