#include<stdio.h> #include<windows.h> int main() { DWORD dwLogical= GetLogicalDrives(); char c='A'; int count=0; while(dwLogical) { if(dwLogical & 0x01) { printf("%c ",c); count++; } dwLogical>>=1; c++; } printf("总共有 %d 个盘。 ",count); return 0; }
#include<stdio.h> #include<windows.h> int main() { DWORD dwLogical= GetLogicalDrives(); char c='A'; int count=0; while(dwLogical) { if(dwLogical & 0x01) { printf("%c ",c); count++; } dwLogical>>=1; c++; } printf("总共有 %d 个盘。 ",count); return 0; }