Link Exchange
- - - - - - - - - - - - - - ผู้ให้การสนับสนุน- - - - - - - - - - - - - -
นำโจทย์มาจาก http://pantip.com/topic/32327481เขียนโค๊ดใน C++ โดยแปลงจากเลขฐานสิบเป็นฐานสองโดยแสดงผลตั้งแต่ 65-122 (A-z ) ให้เรียงเป็นแถวลงมา
/* @Author: Mr.Suppakit Thongdee @Website: www.sourcecode.in.th */ #include <stdio.h> #include <stdlib.h> #include <conio.h> void main(){ int i; int j; int k; int l; int m; char ch; char bin[] = "0000000"; clrscr(); for(i=65; i<=122; i++){ ch = (char)i; printf("%c = ", ch); j = i; m = 6; while(j >0){ k = j / 2; l = j % 2; j = k; if(l==1){ bin[m] = '1'; }else{ bin[m] = '0'; } m = m-1; } printf("%s\n", bin); } getch(); }
Home - Article - Tutorial - Sourcecode - Dev Handbook - Search - WebBoard - Links - About Us