Skip to content

Instantly share code, notes, and snippets.

@sXakil
Last active December 19, 2022 10:47
Show Gist options
  • Save sXakil/d7e88da11830dc1370cb7f89b5ebaae1 to your computer and use it in GitHub Desktop.
Save sXakil/d7e88da11830dc1370cb7f89b5ebaae1 to your computer and use it in GitHub Desktop.
A simple program to print the map of Bangladesh based on the ASCII values of a generated string. (Generator script: https://gist.github.com/sXakil/a7377acba95f8ba2b7dddfaf24339c27)
#include <stdio.h>
int main() {
char *str = "ED.GDAD.DLEB.COCC.CV.FS.HQ."
"JN.MP.Go.Cr.Cq.Cp.Fk.Jf.J`.I`.H`ID."
"J^HE.K^FG.N[ABCG.L`CG.MTBT.MUCS.NTD"
"BCBAJ.NUBBHI.OTMI.OROI.OGDCSI.PE[I."
"RC[I.rBDB.rB.sB.tB";
int c, i, j;
for(i = 0, j = 0; str[i] != '\0'; i++, j++) {
c = str[i]-64;
if(str[i] == 46 && ++j) putchar(10);
else if(j % 2 == 0) while(c-- != 0) putchar(32);
else while(c-- != 0) putchar(124);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment