What is this programming language? C or C++ |#include using namespace std;int charToInt (char ch){ //function to converyt character to integerif(ch >= '0' && ch = @; i--){ //reverse traversal of...


What is this programming language?  C or C++


#include<iostream>|<br>#include<string.h><br>using namespace std;<br>int charToInt (char ch){ //function to converyt character to integer<br>if(ch >= '0' && ch <= '9')<br>1<br>2<br>3<br>4<br>5<br>return (int)ch - '0';<br>6<br>7<br>else<br>8<br>return (int)ch - 'A' + 10;<br>}<br>int toBase10(char *arr){<br>int n = strlen(arr);<br>int p = 1;<br>int result = e;<br>for (int i = n-1; i >= @; i--){ //reverse traversal of array to right to left<br>result = result + (charToInt(arr[i]) * p); //finding the result<br>p = p * 14;<br>}<br>return result;<br>}<br>int main() //main method<br>//function to convert into decimal number<br>//finding the length of char array<br>10<br>11<br>12<br>13<br>//to store the result<br>14 E<br>15<br>16<br>//incrementing the power<br>17<br>18<br>//returning the result<br>19<br>20<br>21 E {<br>char arr[5][18];<br>int answer[5];<br>cout «

Extracted text: #include| #include using namespace std; int charToInt (char ch){ //function to converyt character to integer if(ch >= '0' && ch <= '9')="" 1="" 2="" 3="" 4="" 5="" return="" (int)ch="" -="" '0';="" 6="" 7="" else="" 8="" return="" (int)ch="" -="" 'a'="" +="" 10;="" }="" int="" tobase10(char="" *arr){="" int="" n="strlen(arr);" int="" p="1;" int="" result="e;" for="" (int="" i="n-1;" i="">= @; i--){ //reverse traversal of array to right to left result = result + (charToInt(arr[i]) * p); //finding the result p = p * 14; } return result; } int main() //main method //function to convert into decimal number //finding the length of char array 10 11 12 13 //to store the result 14 E 15 16 //incrementing the power 17 18 //returning the result 19 20 21 E { char arr[5][18]; int answer[5]; cout « "Enter 5 numbers in 14th base\n"; for (int i = 0; i < 5;="" i++){="" cin="" »="" arr[i];="" calling="" the="" function="" and="" storeing="" the="" result="" into="" integer="" array="" answer[i]="toBase1e(arr[i]);" array="" to="" store="" 14th="" base="" numbers="" array="" to="" store="" decimal="" numbers="" 22="" 23="" 24="" 25="" 26="" user="" input="" 27="" 28="" 29="" printing="" the="" result="" cout="" «"number="" in="" 14th="" base\tcorresponding="" decimal="" number\n";="" for="" (int="" i="e;" i=""><5; i++)="" cout="" «"\t"="" «="" arr[i]="" «"\t\t\t"="" «answer[i]=""><«endl; 30 31 32 33 34 return e; 35 } 30="" 31="" 32="" 33="" 34="" return="" e;="" 35="">
Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here