When I want to set the limit of my vector with a variable, the program does not let me. This did not happen to me with code blocks.
The code:
#include <iostream>
using namespace std;
int main()
{
int save,num,c=0,digito,mayor=0;
cout << "ingrese un numero:";
cin>>num;
save=num;
while (num>0){
num/=10;
c++;
}
cout<<"tu numero tiene: "<<c<<" digito"<<endl;
int vect [c*2];
for(int i=0;i<(c*2);i+=2){
vect[i]=0;
}
for(int i=1;i<(c*2);i+=2){
digito=save%10;
vect[i]=digito;
save/=10;
}
for(int i=0;i<c*2;i++){
cout<<vect[i];
}
cout<<endl;
for(int i=0;i<c*2;i++){
if(vect[c]>mayor){
mayor=vect[i];
}
}
cout<<"el mayor es "<<mayor<<endl;
return 0;
}