473,407 Members | 2,315 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

draw a rectangular grid having 10 rows and 10 columns

how to write a c program to draw a rectangular grid having 10 rows and
10 columns. please help me.

Sep 6 '07 #1
7 5468
In article <11*********************@r29g2000hsg.googlegroups. com>,
yugas <yu*************@gmail.comwrote:
>how to write a c program to draw a rectangular grid having 10 rows and
10 columns. please help me.
% the below is deliberately not coded in C
Let top be '|' + repeat '-|' x rows/2 + newline
Let mid be '|' + repeat ' |' x rows/2 + newline
Let grid be repeat {top + mid} x columns/2 + top
Output grid
Turn paper sideways

--
I was very young in those days, but I was also rather dim.
-- Christopher Priest
Sep 6 '07 #2
ro******@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote in news:fbnk8c$623$1
@canopus.cc.umanitoba.ca:
In article <11*********************@r29g2000hsg.googlegroups. com>,
yugas <yu*************@gmail.comwrote:
>>how to write a c program to draw a rectangular grid having 10 rows and
10 columns. please help me.

% the below is deliberately not coded in C
Let top be '|' + repeat '-|' x rows/2 + newline
Let mid be '|' + repeat ' |' x rows/2 + newline
Let grid be repeat {top + mid} x columns/2 + top
Output grid
Turn paper sideways
The original poster should read about C program flow control before
attempting this.
Sep 6 '07 #3
yugas <yu*************@gmail.comwrote:
how to write a c program to draw a rectangular grid having 10 rows and
10 columns. please help me.
how to do homework. please do homework self.

Richard
Sep 6 '07 #4
On Thu, 06 Sep 2007 00:27:39 +0000, yugas wrote:
how to write a c program to draw a rectangular grid having 10 rows and
10 columns. please help me.
#include <stdio.h>
int main(void)
{
puts("+--+--+--+--+--+--+--+--+--+--+");
puts("| | | | | | | | | | |");
puts("+--+--+--+--+--+--+--+--+--+--+");
puts("| | | | | | | | | | |");
puts("+--+--+--+--+--+--+--+--+--+--+");
puts("| | | | | | | | | | |");
puts("+--+--+--+--+--+--+--+--+--+--+");
puts("| | | | | | | | | | |");
puts("+--+--+--+--+--+--+--+--+--+--+");
puts("| | | | | | | | | | |");
puts("+--+--+--+--+--+--+--+--+--+--+");
puts("| | | | | | | | | | |");
puts("+--+--+--+--+--+--+--+--+--+--+");
puts("| | | | | | | | | | |");
puts("+--+--+--+--+--+--+--+--+--+--+");
puts("| | | | | | | | | | |");
puts("+--+--+--+--+--+--+--+--+--+--+");
puts("| | | | | | | | | | |");
puts("+--+--+--+--+--+--+--+--+--+--+");
puts("| | | | | | | | | | |");
puts("+--+--+--+--+--+--+--+--+--+--+");
return 0;
}
--
Army1987 (Replace "NOSPAM" with "email")
If you're sending e-mail from a Windows machine, turn off Microsoft's
stupid “Smart Quotes” feature. This is so you'll avoid sprinkling garbage
characters through your mail. -- Eric S. Raymond and Rick Moen

Sep 6 '07 #5
yugas wrote On 09/05/07 20:27,:
how to write a c program to draw a rectangular grid having 10 rows and
10 columns. please help me.
#define s exit('+')
#define d exit('-')
#define n exit('\n')
#define p exit('|')
#define m exit(' ')
#define r main(g,f);break
#define v case
int main(int g,char**f){extern int putchar(int);int(*exit)
(int)=putchar;switch(-g--){v 97:v 99:v 98:return 0;default
:r;v 12:v 2:v 22:v 29:v 39:v 49:v 56:v 59:v 66:v 76:v 86:v
93:d,d,s,d,d,s,d,r;v 32:v 96:d,d,s,d,d,s,n,r;v 5:v 69:d,d,
s,n,p,m,m,r;v 13:v 20:v 3:v 30:v 40:v 47:v 50:v 57:v 67:v
77:v 84:v 94:d,s,d,d,s,d,d,r;v 23:v 87:d,s,d,d,s,n,p,r;v 60
:d,s,n,p,m,m,p,r;v 17:v 24:v 27:v 34:v 44:v 54:v 61:v 7:v
71:v 81:v 88:v 91:m,m,p,m,m,p,m,r;v 64:m,m,p,m,m,p,n,r;v
37:m,m,p,n,s,d,d,r;v 15:v 18:v 25:v 35:v 45:v 52:v 62:v 72
:v 79:v 8:v 82:v 89:m,p,m,m,p,m,m,r;v 55:m,p,m,m,p,n,s,r;v
28:v 92:m,p,n,s,d,d,s,r;v 42:n,p,m,m,p,m,m,r;v 10:v 74:n,s,
d,d,s,d,d,r;v 16:v 26:v 33:v 36:v 43:v 53:v 6:v 63:v 70:v 73
:v 80:v 9:v 90:p,m,m,p,m,m,p,r;v 46:p,m,m,p,n,s,d,r;v 19:v
83:p,n,s,d,d,s,d,r;v 1:v 11:v 21:v 31:v 38:v 4:v 41:v 48:v
58:v 65:v 68:v 75:v 85:v 95:s,d,d,s,d,d,s,r;v 14:v 78:s,d,d
,s,n,p,m,r;v 51:s,n,p,m,m,p,m,r;}return 0;}

--
Er*********@sun.com
Sep 6 '07 #6
On Sep 5, 5:27 pm, yugas <yugandhar.ku...@gmail.comwrote:
how to write a c program to draw a rectangular grid having 10 rows and
10 columns. please help me.
#include<stdio.h>
char q0??(32767??); void q1(int q2,int q3)??<int q4,q5; for(q4=0;
q4<q2;
q4++)??<putchar('+'); for(q5=0; q5<q3; q5++)putchar('-'); ??
>putchar('+');
putchar('\n'); ??>void q6(int q2,int q3)??<int q4,q5; for(q4=0;
q4<q2; q4
++)??<putchar('|'); for(q5=0; q5<q3; q5++)putchar(' '); ??
>putchar('|');
putchar('\n'); ??>int main(void)??<q7:puts("\105\156\164\145"
"\162\40\164\150\145\40\147\162\151\144\40\150\145 \151\147\150\164\72"
); fflush(stdout); if(fgets(q0,sizeof q0,stdin))??<int q8=atoi(q0);
puts(
"\105\156\164\145\162\40\164\150\145\40\147\162\15 1\144\40"
"\167\151\144\164\150\72"); fflush(stdout); if(fgets(q0,sizeof
q0,stdin))
??<int q9=atoi(q0);
puts("\105\156\164\145\162\40\164\150\145\40\147\1 62\151"
"\144\40\167\151\144\164\150\40\163\143\141\154\14 5\72"
); fflush(stdout); if(fgets(q0,sizeof q0,stdin))??<int q10=atoi(q0);
puts
("\105\156\164\145\162\40\164\150\145\40\147\16 2\
\151\144\40\150\145\151\147\150\164\40\163\143\141 \154\145\72");
fflush
(stdout); if(fgets(q0,sizeof q0,stdin))??<int q11=atoi(q0); int q12;
for(
q12=0; q12<q8; q12++)??<int q13; q1(q9,q10); for(q13=0; q13<q11; q13+
+)q6(q9
,q10); ??>q1(q9,q10); ??>else??<goto q7; ??>??>else??<goto q7; ??>??
>else
??<goto q7; ??>??>else??<goto q7; ??>putchar('\n'); return 0; ??>

Sep 7 '07 #7
On Sep 6, 9:24 pm, user923005 <dcor...@connx.comwrote:
On Sep 5, 5:27 pm, yugas <yugandhar.ku...@gmail.comwrote:
how to write a c program to draw a rectangular grid having 10 rows and
10 columns. please help me.

#include<stdio.h>
char q0??(32767??); void q1(int q2,int q3)??<int q4,q5; for(q4=0;
q4<q2;
q4++)??<putchar('+'); for(q5=0; q5<q3; q5++)putchar('-'); ??>putchar('+');

putchar('\n'); ??>void q6(int q2,int q3)??<int q4,q5; for(q4=0;
q4<q2; q4
++)??<putchar('|'); for(q5=0; q5<q3; q5++)putchar(' '); ??>putchar('|');

putchar('\n'); ??>int main(void)??<q7:puts("\105\156\164\145"
"\162\40\164\150\145\40\147\162\151\144\40\150\145 \151\147\150\164\72"
); fflush(stdout); if(fgets(q0,sizeof q0,stdin))??<int q8=atoi(q0);
puts(
"\105\156\164\145\162\40\164\150\145\40\147\162\15 1\144\40"
"\167\151\144\164\150\72"); fflush(stdout); if(fgets(q0,sizeof
q0,stdin))
??<int q9=atoi(q0);
puts("\105\156\164\145\162\40\164\150\145\40\147\1 62\151"
"\144\40\167\151\144\164\150\40\163\143\141\154\14 5\72"
); fflush(stdout); if(fgets(q0,sizeof q0,stdin))??<int q10=atoi(q0);
puts
("\105\156\164\145\162\40\164\150\145\40\147\16 2\
\151\144\40\150\145\151\147\150\164\40\163\143\141 \154\145\72");
fflush
(stdout); if(fgets(q0,sizeof q0,stdin))??<int q11=atoi(q0); int q12;
for(
q12=0; q12<q8; q12++)??<int q13; q1(q9,q10); for(q13=0; q13<q11; q13+
+)q6(q9
,q10); ??>q1(q9,q10); ??>else??<goto q7; ??>??>else??<goto q7; ??>??>else

??<goto q7; ??>??>else??<goto q7; ??>putchar('\n'); return 0; ??>

Hopefully, this one won't be destroyed by word wrap:

#include<stdio.h>
char q0??(32767??);
void q1(int q2,int q3)??<int q4,q5;
for(q4=0;
q4<q2;

q4++)??<putchar('+');
for(q5=0;
q5<q3;
q5++)putchar('-');
??>putchar('+');

putchar('\n');
??>void q6(int q2,int q3)??<int q4,q5;
for(q4=0;
q4<q2;
q4
++)??<putchar('|');
for(q5=0;
q5<q3;
q5++)putchar(' ');
??>putchar('|');

putchar('\n');
??>int main(void)??<q7:puts("\105\156\164\145\162\40\164\ 150"
"\145\40\147\162\151\144\40\150\145\151\147\150\16 4\72"
);
fflush(stdout);
if(fgets(q0,sizeof q0,stdin))??<int q8=atoi(q0);
puts(
"\105\156\164\145\162\40\164\150\145\40\147\162\15 1\144\40"
"\167\151\144\164\150\72");
fflush(stdout);
if(fgets(q0,sizeof q0,stdin))
??<int q9=atoi(q0);
puts("\105\156\164\145\162\40\164\150\145\40\147\1 62\151"
"\144\40\167\151\144\164\150\40\163\143\141\154\14 5\72"
);
fflush(stdout);
if(fgets(q0,sizeof q0,stdin))??<int q10=atoi(q0);
puts
("\105\156\164\145\162\40\164\150\145\40\147\162\1 51\144\40"
"\150\145\151\147\150\164\40\163\143\141\154\145\7 2");
fflush
(stdout);
if(fgets(q0,sizeof q0,stdin))??<int q11=atoi(q0);
int q12;
for(
q12=0;
q12<q8;
q12++)??<int q13;
q1(q9,q10);
for(q13=0;
q13<q11;
q13++)q6(q9
,q10);
??>q1(q9,q10);
??>else??<goto q7;
??>??>else??<goto q7;
??>??>else
??<goto q7;
??>??>else??<goto q7;
??>putchar('\n');
return 0;
??>

Sep 7 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Kai Grossjohann | last post by:
I have a file which contains component definitions, along with their x/y coordinates and width and height. Examples for components are a short text string, a text entry field, a date entry field,...
4
by: Mike L | last post by:
I'm open for any suggestions on how to better program this. I want the user to select a license from a combo box, cboPrivilege and then the user will click the add button, then a record will be...
6
by: Tejpal Garhwal | last post by:
I have datagrid filled with some data rows. At the run time i want know how many total rows are there in the data grid ? Any idea ? Any Suggestions ? Thanks in advance Tej
2
by: Tom | last post by:
I need to display a series of controls (in my case, a custom control) in a grid-like fashion. This means this particular control would be repeated multiple times, arranged in a row/column format....
117
by: phil-news-nospam | last post by:
Is there really any advantage to using DIV elements with float style properies, vs. the old method of TABLE and TR and TD? I'm finding that by using DIV, it still involves the same number of...
0
by: Gian Paolo | last post by:
this is something really i can't find a reason. I have a form with a tabcontrol with tree pages, in the second page there is a Data GRid View. Plus i have a class. When i open the form i...
3
by: veenna | last post by:
How can i refresh datagrid in vb.net. I want to display color in one cell in grid but when it loads first time it is working here is my code Public Class Dialog_Colorazione Const YEAR_START...
0
by: patogenic | last post by:
I want to use the grid for record insertion. Everything works fine except after saving the new record; all controls for record insertion are still visible besides the "Add New" button. I think...
2
by: Claudia Fong | last post by:
Hi, How can I create a grid of 20 Columns by 30 Rows using asp.net? Cheers! Claudi *** Sent via Developersdex http://www.developersdex.com ***
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.