Algorithm


 problem Link ;  https://www.codechef.com/problems/FLOW010 

Problem

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

Input Format

The first line contains an integer T, the total number of testcases. Then T lines follow, each line contains a character.

Output Format

For each test case, display the Ship Class depending on ID, in a new line.

Constraints

  •  T  1000

Sample 1:

Input
 
Output
 
3 
B
c
D
BattleShip
Cruiser
Destroyer

 

Code Examples

#1 Code Example with C Programming

Code - C Programming

#include<stdio.h>
int main()
{
    int n,i;
    char ch;
    scanf("%d",&n);
    for(i=1;i < =n;i++)
    {
        scanf(" %c",&ch);
        if(ch=='B' || ch=='b') printf("BattleShip\n");
        else if(ch=='C' || ch== 'c') printf("Cruiser\n");
        else if(ch=='D' || ch== 'd') printf("Destroyer\n");
        else if(ch=='F' || ch== 'f') printf("Frigate\n");
    }
} 
Copy The Code & Try With Live Editor

Input

x
+
cmd
3
B c
D

Output

x
+
cmd
BattleShip
Cruiser
Destroyer
Advertisements

Demonstration


CodeCherf solution FLOW010  - ID and Ship Codecherf solution in C,C++

Previous
CodeChef solution BMI - Body Mass Index Codechef solution in C,C++
Next
CodeChef solution NUM239 - Counting Pretty Numbers Codechef solution in C,C++