memo 数値⇔文字 桁数

文字⇒数値

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  int a = (S[1] - '0');
  a *= 2;
    
  cout << a << endl;
}

数値⇒文字

  string S = "hello";
  int a = 3;
  cout << S + to_string(a) << endl;

桁数を求める

  int digit = 0;
  while(N != 0){
   N = N / 10;
   digit++;
  }