c++ - How to find the position of a digit and use them -


#include <iostream> #include <math.h> #include <string> #include <sstream> using namespace std;  int main() {     string input;     int value,     cout << "input number: " << endl;    cin >> input;    const int count = input.length();    istringstream buffer(input);    buffer >> value;    if (count == 4) { 

my program suppose count length of number, if it's 4 encode digits. eg. 1234 turns other digits. question how take each individual digit , use them. eg. take (1+1)/10, or (3+2)/10.

you can character in string using bracket notation, e.g input[0] first character in string.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -