hello, so im designing a simple prgram which calculates the cost of a ticket you buy. there are only 3 ticket options, namely a b and c.
here is my code.
#include <iostream>
using namespace std;
const int PRICE = 3;
int find(int [PRICE]);
int main()
{
int nums[PRICE] = {2, 3 ,4};
int ticket;
cout<<"select a ticket"<<endl;
cin>>ticket;
switch (ticket)
{
case 'A' : cout<<"cost is"<<nums[0]<<endl;
break;
case 'B' : cout<<"cost is"<<nums[1]<<endl;
break;
case 'C' : cout<<"cost is"<<nums[2]<<endl;
break;
default: cout<<"wrong ticket"<<endl;
}
system("pause");
return 0;
}
however for whichever letter i put in i always get 'wrong ticket' any help would be appreciated thanks.
simply if i input 'A' it should output 'cost is 2', if i input 'B' it should output 'cost is 3' etc