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

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

/*
x-->千位
y-->百位
z-->十位
w-->个位
*/

#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;
}

你可能感兴趣的:(C/C++一般性问题)