jeudi 7 novembre 2019

How can I seperate digit like 12345 to 1 2 3 4 5 starting from 1 to 5 in c++, but without using functions

#include <iostream>
using namespace std;
int main()
{
    int n, i = 0, num1, num2, m, sum = 0, n1, d, m;
    cout << "Jepe nje numer \n";
    cin >> n;

    while (n != 0)
    {
        n = n / 10;
        i++;
    }
    num1 = m % 10;
    d = pow(10, i - 1);
    m = n;
    int f = d, fl = f;
    cout << f << endl;
    num2 = m / d;
    while (f > 0)
    {
    \\ then I have to change digits 12345 to 52341

if (f == fl)

    {
        sum = sum + num1 * f;
        m = m % f;
        f = f / 10;
        cout << f << endl;
    }

    }
    cout << sum << endl;
    cin.get();

** \It just doesnt shows \It just doesnt shows \It just doesnt shows \It just doesnt shows \It just doesnt shows \It just doesnt shows \It just doesnt shows **

}

\please help

Aucun commentaire:

Enregistrer un commentaire