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
#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;
}
Comments
Leave a comment