Need suggestions if I should be using string so i could get this output:
xcomputers
0123456789
user must enter characters...
sample:
enter characters: tr.xx
equivalent: 68.00
where x=0,c=1,o=2... and so on...
i'm not sure how to use the string so my output is always the conversion of first character i entered.
here's my code:
#include<iostream.h>
int main(void)
{
char l;
cout<<"xcomputers";
cout<<"0123456789";
cout<<"enter characters:";
cin>>l;
if (l=='x')
cout<<"0";
else if (l=='c')
cout<<"1";
else if (l=='o')
cout<<"2";
else if (l=='m')
cout<<"3";
else if (l=='p')
cout<<"4";
else if (l=='u')
cout<<"5";
else if (l=='t')
cout<<"6";
else if (l=='e')
cout<<"7";
else if (l=='r')
cout<<"8";
else if (l=='s')
cout<<"9";
else
cout<<"*";
return 0;
}