fork(3) download
  1. #include <stdio.h>
  2. // ^ only used in main()
  3.  
  4. f(int m,int n,char*s){int i=0,w=3+m++;for(;i<w*m*n+w;++i)s[i]=i%w>m?10:" |-+-o"[!(i/w%m)*2+!(i%w%m)+!(i/w%(m*n))*2];s[i]=0;}
  5.  
  6. int main() {
  7. char buf[1024];
  8. f(5, 3, buf);
  9. puts(buf);
  10. return 0;
  11. }
Success #stdin #stdout 0s 2160KB
stdin
Standard input is empty
stdout
o-----o
|     |
|     |
|     |
|     |
|     |
+-----+
|     |
|     |
|     |
|     |
|     |
+-----+
|     |
|     |
|     |
|     |
|     |
o-----o