Click here to Skip to main content
15,917,645 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: The output seem confusing please clear my doubt Pin
David Crow21-Oct-09 5:08
David Crow21-Oct-09 5:08 
GeneralRe: The output seem confusing please clear my doubt Pin
venkatasu21-Oct-09 6:10
venkatasu21-Oct-09 6:10 
GeneralRe: The output seem confusing please clear my doubt Pin
Richard MacCutchan21-Oct-09 6:25
mveRichard MacCutchan21-Oct-09 6:25 
GeneralRe: The output seem confusing please clear my doubt Pin
David Crow21-Oct-09 6:32
David Crow21-Oct-09 6:32 
GeneralRe: The output seem confusing please clear my doubt Pin
Tim Craig21-Oct-09 20:02
Tim Craig21-Oct-09 20:02 
GeneralRe: The output seem confusing please clear my doubt Pin
Chuck O'Toole21-Oct-09 5:05
Chuck O'Toole21-Oct-09 5:05 
AnswerRe: The output seem confusing please clear my doubt Pin
transoft21-Oct-09 7:05
transoft21-Oct-09 7:05 
Questionnumbers with boxes Pin
kbury21-Oct-09 3:59
kbury21-Oct-09 3:59 
I have this code and cannot seem to ge the numbers to print out to 20 within the boxes. Any help would be appreciated. Thanks

Suppose to be this:

+---+---+---+---+---+
| 1 | 2 | 3 | 4 | 5 |
+---+---+---+---+---+
| 6 | 7 | 8 | 9 | 10|
+---+---+---+---+---+
| 11| 12| 13| 14| 15|
+---+---+---+---+---+
| 16| 17| 18| 19| 20|
+---+---+---+---+---+

Here is what I get:

How many rows of mailboxes will there be?4

How many columns of mailboxes will there be?5


The numbering layout will be:
+---+---+---+---+---+
| 1 | 2 | 3 | 4 | 5 |



Overall height of mailbox unit: 24
Overall width of mailbox unit: 20

<#define mbxhgt  6
#define mbxwid  4

int main (void)
{
int    rows,
       cols,
	   r = 1,
	   c = 1,
	   boxnum = 1,
	   unit_height,
	   unit_width;

system("cls");

printf ("Mailbox Layout Program\n\n");

printf ("How many rows of mailboxes will there be?");
scanf ("%d", &rows);

printf ("\nHow many columns of mailboxes will there be?");
scanf ("%d", &cols);

printf ("\n\nThe numbering layout will be:\n");
printf("+---+---+---+---+---+\n|");



while (c <= cols)

{
c = c + 1;
printf (" %d |", boxnum);
boxnum = boxnum + 1;
c = c++;
}


while (r <= rows)
{
r = r + 1;
printf ("\n \n");
boxnum = boxnum + 1;
r = r++;
}


unit_height = rows * mbxhgt;
unit_width = cols * mbxwid;



printf ("\nOverall height of mailbox unit: %d", unit_height);


printf ("\nOverall width of mailbox unit: %d\n", unit_width);



return (0);
/pre>

AnswerRe: numbers with boxes Pin
David Crow21-Oct-09 4:08
David Crow21-Oct-09 4:08 
GeneralRe: numbers with boxes Pin
kbury21-Oct-09 4:22
kbury21-Oct-09 4:22 
QuestionRe: numbers with boxes Pin
David Crow21-Oct-09 4:29
David Crow21-Oct-09 4:29 
AnswerRe: numbers with boxes Pin
kbury21-Oct-09 4:39
kbury21-Oct-09 4:39 
GeneralRe: numbers with boxes Pin
David Crow21-Oct-09 4:46
David Crow21-Oct-09 4:46 
GeneralRe: numbers with boxes Pin
kbury21-Oct-09 4:53
kbury21-Oct-09 4:53 
GeneralRe: numbers with boxes Pin
David Crow21-Oct-09 4:57
David Crow21-Oct-09 4:57 
GeneralRe: numbers with boxes Pin
kbury21-Oct-09 5:40
kbury21-Oct-09 5:40 
GeneralRe: numbers with boxes Pin
David Crow21-Oct-09 5:43
David Crow21-Oct-09 5:43 
GeneralRe: numbers with boxes Pin
kbury21-Oct-09 5:52
kbury21-Oct-09 5:52 
QuestionRe: numbers with boxes Pin
David Crow21-Oct-09 6:03
David Crow21-Oct-09 6:03 
GeneralRe: numbers with boxes Pin
kbury21-Oct-09 6:32
kbury21-Oct-09 6:32 
GeneralRe: numbers with boxes Pin
kbury21-Oct-09 6:53
kbury21-Oct-09 6:53 
QuestionRe: numbers with boxes Pin
David Crow21-Oct-09 7:04
David Crow21-Oct-09 7:04 
GeneralRe: numbers with boxes Pin
kbury21-Oct-09 7:31
kbury21-Oct-09 7:31 
GeneralRe: numbers with boxes Pin
David Crow21-Oct-09 7:36
David Crow21-Oct-09 7:36 
GeneralRe: numbers with boxes Pin
kbury21-Oct-09 7:47
kbury21-Oct-09 7:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.