Hi,
I a real newbie when refering to programming. I keep having this error but I don't know what it means. Can somebody help me?
I looked it up on google but I couldn't find anything of usefull so I tought posting it.
Can you please tell me what an I doing wrong?

#include <iostream>

using namespace std;

int main()
{
    int n,x,u,nr,s,s2;
    cin<<n;
    cin<<x;
    nr=0;
    s=0;
    s2=0;
    while(n!=0)
    {
        while(nr!=0)
        {
            u=n%10;
            s+=u;
            nr/=10;
        }
        if(s>10)
        {
            u=s%10;
            s2=s2+u;
            s2/=10;
        }
        if(x=s2)
        {
            n-=1;
            nr++;
            cout<<"Pentru nr="<<nr<<" cifra de ordine este x="<<x<<" si au mai ramas "<<n<<" numere";
        }
        else
        {
            nr++;
        }
    }
    return 0;
}

Recommended Answers

All 2 Replies

The operator for cin should be >>

std::cin >> n;
std::cin >> x;

Yes, what nullptr said. The << operator is the output operator, but cin is an input stream so it won't have an operator<<().

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.