| | |
printing double array formatting trouble
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Mar 2006
Posts: 28
Reputation:
Solved Threads: 0
Hi guys inside the double array it holds '?' character.
How would i do the format printing to print it like this
ithe user input variable is the size variable
if 5 is typed in it suppose to print 5 rows and columns and print 2 rows and columns if i entered 2.
for example
user inputs 2
+---+---+
| '?' | '?' |
+---+---+
| '?' | '?'|
+---+---+
it has to print the grid like this and im havin trouble with the formatting
How would i do the format printing to print it like this
ithe user input variable is the size variable
if 5 is typed in it suppose to print 5 rows and columns and print 2 rows and columns if i entered 2.
for example
user inputs 2
+---+---+
| '?' | '?' |
+---+---+
| '?' | '?'|
+---+---+
it has to print the grid like this and im havin trouble with the formatting
C Syntax (Toggle Plain Text)
void printGridMineSize(char displayGrid[MAX_GRID][MAX_GRID], unsigned size, int getMineSize) { int i=0; int k=0; int j=0; printf("-------------------\n"); for(i=0; i<size; i++) { for(k=0; k<size; k++) { printf("%c",displayGrid[i][k]); } /*printf(" %c \n",displayGrid[i][k]); */ printf("\n"); } for(j=0; j<size; j++) { printf("+---+"); } printf("\n"); }
•
•
Join Date: Jun 2004
Posts: 126
Reputation:
Solved Threads: 2
Buffer size is too much , reduce it
>it has to print the grid like this and im havin trouble with the formatting
Do you need to print the grid as well as the array contents? If so, it takes a smidge more work.
>Buffer size is too much , reduce it
That's a rather useless comment. Elaborate, or don't bother posting.
Do you need to print the grid as well as the array contents? If so, it takes a smidge more work.

C Syntax (Toggle Plain Text)
for ( i = 0; i < limit; i++ ) { /* Print a grid line */ for ( j = 0; j < limit; j++ ) printf ( "+---" ); printf ( "+\n|" ); /* Print the row */ for ( j = 0; j < limit; j++ ) printf ( "'%c'|", grid[i][j] ); putchar ( '\n' ); } /* Print the last grid line */ for ( j = 0; j < limit; j++ ) printf ( "+---" ); printf ( "+\n|" );
That's a rather useless comment. Elaborate, or don't bother posting.
New members chased away this month: 4
![]() |
Similar Threads
- C++ Array help needed (C++)
- Printing a sorted array. (VB.NET)
- Formatting with Filestream Pointers... (C)
- transfer double array from asp to javascript (ASP.NET)
- array from StringTokenizer (Java)
- Array with names (C)
Other Threads in the C Forum
- Previous Thread: everything abt container classes
- Next Thread: i can't seem to make my search function work.... help!...
Views: 2849 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for C
#include adobe ansi api array arrays asterisks binarysearch calculate centimeter char command convert copyimagefile cprogramme creafecopyofanytypeoffileinc csyntax directory dynamic fflush file fork forloop framework frequency functions getlasterror givemetehcodez grade graphics gtkgcurlcompiling hacking hardware highest homework inches incrementoperators kernel km lazy linked linkedlist linux linuxsegmentationfault list lists locate logical_drives looping loopinsideloop. match matrix microsoft motherboard multi mysql number opendocumentformat opensource owf pattern pdf performance pointer posix problem probleminc process program programming radix recursion recv repetition research scanf scripting segmentationfault sequential shape socket socketprograming spoonfeeding stack standard string strings structures student systemcall testautomation threads turboc unix user variable voidmain() wab win32 windows.h






