Answer to Question #130538 in C++ for Zaib Mk

Question #130538

Develop the program that accept the code number as an input and displays the correct    disk drive manufacture as follows ?


Code               disk drive manufacturing


1                    western digital

2                    3M corporation

3                   Maxell Corporation

4                   Sony Corporation

5                   Verbatataon corporation 


1
Expert's answer
2020-08-24T15:22:03-0400
#include <iostream>
using namespace std;

int main()
{
    string manufacturers[] = {"western digital",
                              "3M corporation",
                              "Maxell Corporation",
                              "Sony Corporation",
                              "Verbatataon corporation"};
    int code;
    cout << "Enter code number: ";
    cin >> code;
    if(code < 1 || code > 5)  // outside range
        cout << "Invalid code" << endl;
    else
        cout << "Disk drive manufacturer is " << manufacturers[code - 1] << endl;
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS