This is what I have so far:
#include <iostream>
#include <cmath>
#include <string.h>
using namespace std;
int main() {
    string hexa = "1A";
    
//  cout<<"HEXADECIMAL TO DECIMAL\n";
//  cout<<"ENTER HEXADECIMAL: ";
//  cin>>hexa;  
    
//  int inc1 = 0, hex1, ans, total = 0;
                            
    int a=0, b=1, ans, count=0, total, size=hexa.length();
    //count also increment
    
    for (int i=0; i<hexa.length(); i++){
        if(hexa[i] == 'A'){
            ans = 10 * pow(16, i);
        } else {
            ans = hexa[i] * pow(16, i);
        }
        total = total + ans;
    }
    
    cout<<"ANSWER IS: " <<total;    
/**
    do{
    hex1 = hexa % 10;
    ans = hex1 * pow(16, inc1);
    inc1++;
    total = total + ans;
    hexa = hexa / 10;
    } while (hexa!=0);
    
    
**/
}
I could just steal some codes online but I don't want to cheat this one (my teachers are getting suspicious of me). The code inside the comment works, the one with the do-while loop but it only works with numbers-only input. Im struggling to create a code that accepts input with letters. Also, Im not permitted to use those fancy functions and whatnot.
 
    