Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - In c++, I want to enter a character variable in the defined plastic variable.
In c++, I want to enter a character variable in the defined plastic variable.
# include & ltiostream & gt

# include & ltcstdlib & gt

Use namespace std

void main(){

char x[ 100],y[ 100];

int i=0,z;

CIN & gt; & gtx;

if(x[0]& lt; 9 ' & amp& ampx[0]& gt;' 0'){

while(x[I]& lt; 9 ' & amp& ampx[I]& gt;' 0')

y[I]= x[i++];

y[I]= ' \ 0 ';

z = atoi(y);

}

Otherwise {

z = x[0];

}

cout & lt& ltz & lt& ltendl

}

Enter a string, for example:

Enter' 1453 1', z= 1453 1.

Enter' 1453 1afasd', z= 1453 1.

Enter a, z=97.

Enter "adas" and z=97.