天天看点

提取四位数的千位,百位,十位,个位

// bit.cpp : Defines the entry point for the console application.

//

#include "stdafx.h"

#include "stdio.h"

int main(int argc, char* argv[])

{

 int i=5687;

 int x,y,z,w;

 x=i/1000;

 y=(i-x*1000)/100;

 z=(i-x*1000-y*100)/10;

 w=i-x*1000-y*100-z*10;

 printf("x is : %d/n",x);

 printf("y is : %d/n",y);

 printf("z is : %d/n",z);

 printf("w is : %d/n",w);

 return 0;

}