In this program I have to enter 2 whole numbers a and b and the program should display on the screen the numbers harshad (numbers that are divisible by the sum of their numbers) between a and b. A and b must be positive, and b greater than a.
In the compilation it tells me that there are failures in the operator ++
of the for, and one of the whiles (I do not know which).
The program that I have used is:
#include<iostream>
#include<string>
using namespace std;
int main(){
int a,b,n,suma;
string numero;
bool harshad;
harshad = (numero%suma=0);
cout<<"introduce los numeros a y b:";
cin>>a>>b;
while((a<=0)||(b<a){
cout<<"introduce los numeros a y b:";
cin>>a>>b;
}
for(numero=a;numero<=b;numero++){
n=0;
while(numero.at(n)!=0){
numero.at(n)=numero.at(n)+numero.at(n+1);
}
}
suma=numero.at(n);
while(harshad=true){
cout<<numero<<endl;
numero++;
}
return 0;
}