Click here to Skip to main content
15,886,963 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: const char [] and char[] difference question Pin
David Crow10-May-18 17:22
David Crow10-May-18 17:22 
AnswerRe: const char [] and char[] difference question Pin
Richard MacCutchan10-May-18 21:25
mveRichard MacCutchan10-May-18 21:25 
AnswerRe: const char [] and char[] difference question Pin
Victor Nijegorodov10-May-18 23:03
Victor Nijegorodov10-May-18 23:03 
GeneralRe: const char [] and char[] difference question Pin
samzcs11-May-18 2:24
samzcs11-May-18 2:24 
QuestionPlease advise me on C++ coding structure Pin
Vaclav_9-May-18 4:24
Vaclav_9-May-18 4:24 
AnswerRe: Please advise me on C++ coding structure Pin
leon de boer9-May-18 4:44
leon de boer9-May-18 4:44 
QuestionHelp with C Pin
Faith Burnett5-May-18 10:28
Faith Burnett5-May-18 10:28 
AnswerRe: Help with C Pin
David Crow5-May-18 16:57
David Crow5-May-18 16:57 
Faith Burnett wrote:
To be honest I’m new to this and thought it would simply print out two right aligned pyramids with a gap in between.
Those two for() loops are printing the same NUMBER of hashes from where the stdout stream happens to be at the point the for() loop starts printing. Since the stdout stream is at "column" 0 before the first for() loop, the first set of hashes is right justified (preceded with spaces), and since the stdout stream is at "column" H+2 after the first two inner for() loops run, the second set of hashes always starts in the same "column."

You might want to consider changing your for() loop boundaries so that the pyramid has a "pointed" top at level 1, and no leading/trailing spaces at level h:
for (int i = 0; i < h; i++)
{
    ...
    // Print out this many spaces
    for (int j = 0; j < h - i - 1; j++)
    ...
    // Print left hashes
    for (int j = 0; j < i + 1; j++)
    ...
    // Print right hashes
    for (int j = 0; j < i + 1; j++)
    ...
}

"One man's wage rise is another man's price increase." - Harold Wilson

"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles



modified 6-May-18 0:28am.

GeneralRe: Help with C Pin
Faith Burnett5-May-18 19:08
Faith Burnett5-May-18 19:08 
QuestionHow to get value Pin
Vaclav_5-May-18 4:41
Vaclav_5-May-18 4:41 
AnswerRe: How to get value Pin
Richard MacCutchan5-May-18 5:47
mveRichard MacCutchan5-May-18 5:47 
GeneralRe: How to get value Pin
Vaclav_6-May-18 3:54
Vaclav_6-May-18 3:54 
GeneralRe: How to get value Pin
Richard MacCutchan6-May-18 4:48
mveRichard MacCutchan6-May-18 4:48 
GeneralRe: How to get value Pin
Vaclav_6-May-18 6:49
Vaclav_6-May-18 6:49 
QuestionWrapping c++ Pin
Member 129991324-May-18 22:48
Member 129991324-May-18 22:48 
AnswerRe: Wrapping c++ Pin
Richard MacCutchan5-May-18 1:26
mveRichard MacCutchan5-May-18 1:26 
GeneralRe: Wrapping c++ Pin
Member 129991325-May-18 5:06
Member 129991325-May-18 5:06 
GeneralRe: Wrapping c++ Pin
Richard MacCutchan5-May-18 5:42
mveRichard MacCutchan5-May-18 5:42 
QuestionMessage Closed Pin
2-May-18 23:33
Lapmangfpt2-May-18 23:33 
AnswerRe: help: list<struct> of list<string> Pin
Victor Nijegorodov2-May-18 23:57
Victor Nijegorodov2-May-18 23:57 
QuestionThe Breakpoint will not be hit the Source Code is different then the orignal Pin
ForNow30-Apr-18 16:08
ForNow30-Apr-18 16:08 
AnswerRe: The Breakpoint will not be hit the Source Code is different then the orignal Pin
Richard MacCutchan30-Apr-18 21:32
mveRichard MacCutchan30-Apr-18 21:32 
GeneralRe: The Breakpoint will not be hit the Source Code is different then the orignal Pin
ForNow1-May-18 15:53
ForNow1-May-18 15:53 
QuestionWhat are the best mocking frameworks available on Linux? Pin
Hila Berger29-Apr-18 2:13
Hila Berger29-Apr-18 2:13 
JokeRe: What are the best mocking frameworks available on Linux? Pin
Randor 29-Apr-18 15:32
professional Randor 29-Apr-18 15:32 

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.