Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - C++ program input 100, how to output 00 1. Thank you.
C++ program input 100, how to output 00 1. Thank you.
# include & ltiostream & gt

Use namespace std

int main()

{

int a,b,c,m,n;

Cout & lt& lt "Please enter a three-digit integer:";

CIN & gt; & gtn;

a =(int)n/ 100; //Because the type of variable A is an integer, you divide n by 100 to get a floating-point number such as 1.25, so you have to force type conversion.

b =(int)((n-a * 100)/ 10);

c = n-a * 100-b * 10;

m = c * 100+b * 10+a;

cout & lt& lt" a = " & lt& lta & lt& ltendl

cout & lt& lt" b = " & lt& ltb & lt& ltendl

cout & lt& lt" c = " & lt& ltc & lt& ltendl

cout & lt& lt" m = " & lt& ltm & lt& ltendl

Returns 0;

}