Click here to Skip to main content
15,885,366 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionConverting from MFC to Native Windows C Pin
ForNow12-May-22 12:48
ForNow12-May-22 12:48 
AnswerRe: Converting from MFC to Native Windows C Pin
Richard MacCutchan13-May-22 0:29
mveRichard MacCutchan13-May-22 0:29 
GeneralRe: Converting from MFC to Native Windows C Pin
ForNow13-May-22 1:34
ForNow13-May-22 1:34 
GeneralRe: Converting from MFC to Native Windows C Pin
Richard MacCutchan13-May-22 2:05
mveRichard MacCutchan13-May-22 2:05 
GeneralRe: Converting from MFC to Native Windows C Pin
ForNow13-May-22 3:10
ForNow13-May-22 3:10 
GeneralRe: Converting from MFC to Native Windows C Pin
Richard MacCutchan13-May-22 3:48
mveRichard MacCutchan13-May-22 3:48 
Questionmy problem is output for this weight conversion pounds to kilogram that starts from 100 to 300. Pin
Member 1563347212-May-22 0:17
Member 1563347212-May-22 0:17 
AnswerRe: my problem is output for this weight conversion pounds to kilogram that starts from 100 to 300. Pin
OriginalGriff12-May-22 0:26
mveOriginalGriff12-May-22 0:26 
Start by indenting your code so it's readable:
#include <stdio.h>

int main()
    {
    int i,j;
    float pound, kilogram;
    
    printf("Pound --------- Kilos\n\n");
    do
        {
        j=1;
        do
            {
            printf("%5d\t",i*j);
            printf("%.2f lbs = %.2f Kg\n", pound, kilogram);
            j++;
            } while(j<=100);
        printf("\n");
        i++;
        } while(i<=300);
    return 0;
    }
It makes it so much more obvious what is going on.

Then look at your code: where do you modify pound or kilogram?
Since they do not change, it will always print the same values.

By the way, a better loop format for your application would be a for loop:
C++
for (int i = 0; i <= 300; i++)
    {
    for (int j = 1; j <= 100; j++)
        {
        ...
        }
    }
Since you don't initialize i in your code at all, the value can be random depending on which compiler and / or compiler options you use.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!

QuestionRe: my problem is output for this weight conversion pounds to kilogram that starts from 100 to 300. Pin
Member 1563347212-May-22 0:43
Member 1563347212-May-22 0:43 
AnswerRe: my problem is output for this weight conversion pounds to kilogram that starts from 100 to 300. Pin
Richard Deeming12-May-22 0:54
mveRichard Deeming12-May-22 0:54 
AnswerRe: my problem is output for this weight conversion pounds to kilogram that starts from 100 to 300. Pin
Michael Hulthin12-May-22 1:06
Michael Hulthin12-May-22 1:06 
GeneralRe: my problem is output for this weight conversion pounds to kilogram that starts from 100 to 300. Pin
Member 1563347212-May-22 1:21
Member 1563347212-May-22 1:21 
GeneralRe: my problem is output for this weight conversion pounds to kilogram that starts from 100 to 300. Pin
Member 1563347212-May-22 1:44
Member 1563347212-May-22 1:44 
GeneralRe: my problem is output for this weight conversion pounds to kilogram that starts from 100 to 300. Pin
Michael Hulthin12-May-22 1:59
Michael Hulthin12-May-22 1:59 
GeneralRe: my problem is output for this weight conversion pounds to kilogram that starts from 100 to 300. Pin
Member 1563347212-May-22 2:16
Member 1563347212-May-22 2:16 
Questionhow to capture mouse movement and click in windows service Pin
Shkuratov U11-May-22 16:57
Shkuratov U11-May-22 16:57 
AnswerRe: how to capture mouse movement and click in windows service Pin
Richard MacCutchan11-May-22 21:43
mveRichard MacCutchan11-May-22 21:43 
AnswerRe: how to capture mouse movement and click in windows service Pin
Richard Deeming11-May-22 21:44
mveRichard Deeming11-May-22 21:44 
Questionconflicting types for 'uint32_t' issue Pin
focusdoit5-May-22 3:17
focusdoit5-May-22 3:17 
AnswerRe: conflicting types for 'uint32_t' issue Pin
Richard MacCutchan5-May-22 4:02
mveRichard MacCutchan5-May-22 4:02 
AnswerRe: conflicting types for 'uint32_t' issue Pin
Randor 5-May-22 9:28
professional Randor 5-May-22 9:28 
GeneralRe: conflicting types for 'uint32_t' issue Pin
focusdoit5-May-22 14:04
focusdoit5-May-22 14:04 
GeneralRe: conflicting types for 'uint32_t' issue Pin
Randor 5-May-22 14:31
professional Randor 5-May-22 14:31 
GeneralRe: conflicting types for 'uint32_t' issue Pin
Richard MacCutchan5-May-22 22:23
mveRichard MacCutchan5-May-22 22:23 
QuestionComplier error C2280 explanation Pin
ForNow5-May-22 1:37
ForNow5-May-22 1:37 

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.