Click here to Skip to main content
15,895,370 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Base types and pointer arrays Pin
CPallini5-Jul-21 21:03
mveCPallini5-Jul-21 21:03 
GeneralRe: Base types and pointer arrays Pin
Richard Andrew x646-Jul-21 3:57
professionalRichard Andrew x646-Jul-21 3:57 
AnswerRe: Base types and pointer arrays Pin
jschell17-Jul-21 10:09
jschell17-Jul-21 10:09 
GeneralRe: Base types and pointer arrays Pin
Richard Andrew x6417-Jul-21 13:39
professionalRichard Andrew x6417-Jul-21 13:39 
QuestionLiteral for a short Pin
Richard Andrew x645-Jul-21 11:47
professionalRichard Andrew x645-Jul-21 11:47 
AnswerRe: Literal for a short Pin
Greg Utas5-Jul-21 12:24
professionalGreg Utas5-Jul-21 12:24 
GeneralRe: Literal for a short Pin
Richard Andrew x645-Jul-21 12:55
professionalRichard Andrew x645-Jul-21 12:55 
QuestionDebug Application from Service Pin
Richard Andrew x643-Jul-21 14:16
professionalRichard Andrew x643-Jul-21 14:16 
AnswerRe: Debug Application from Service Pin
Daniel Pfeffer3-Jul-21 17:24
professionalDaniel Pfeffer3-Jul-21 17:24 
AnswerRe: Debug Application from Service Pin
Richard MacCutchan3-Jul-21 21:11
mveRichard MacCutchan3-Jul-21 21:11 
AnswerRe: Debug Application from Service Pin
Joe Woodbury4-Jul-21 17:14
professionalJoe Woodbury4-Jul-21 17:14 
GeneralRe: Debug Application from Service Pin
Richard Andrew x645-Jul-21 6:25
professionalRichard Andrew x645-Jul-21 6:25 
QuestionMultiple view ports in single window using opengl and c++ Pin
Member 107421151-Jul-21 23:15
Member 107421151-Jul-21 23:15 
SuggestionRe: Multiple view ports in single window using opengl and c++ Pin
CHill601-Jul-21 23:16
mveCHill601-Jul-21 23:16 
AnswerRe: Multiple view ports in single window using opengl and c++ Pin
Richard MacCutchan1-Jul-21 23:59
mveRichard MacCutchan1-Jul-21 23:59 
QuestionNative VS Debugger Question - SOLVED Pin
Richard Andrew x6428-Jun-21 10:39
professionalRichard Andrew x6428-Jun-21 10:39 
AnswerRe: Native VS Debugger Question Pin
Richard MacCutchan28-Jun-21 21:03
mveRichard MacCutchan28-Jun-21 21:03 
GeneralRe: Native VS Debugger Question Pin
Richard Andrew x6429-Jun-21 10:07
professionalRichard Andrew x6429-Jun-21 10:07 
GeneralRe: Native VS Debugger Question Pin
Richard MacCutchan29-Jun-21 10:16
mveRichard MacCutchan29-Jun-21 10:16 
QuestionMessage Closed Pin
27-Jun-21 5:05
Member 1496877127-Jun-21 5:05 
AnswerRe: How to verify apt install (application file ) executable installation ? Pin
Richard MacCutchan27-Jun-21 5:26
mveRichard MacCutchan27-Jun-21 5:26 
AnswerRe: How to verify apt install (application file ) executable installation ? Pin
k505427-Jun-21 5:56
mvek505427-Jun-21 5:56 
QuestionAccurate interpretation and evaluation of this "or condition": while ( x < 1 || x > 8 ) Pin
Otto Medina25-Jun-21 21:36
Otto Medina25-Jun-21 21:36 
AnswerRe: Accurate interpretation and evaluation of this "or condition": while ( x < 1 || x > 8 ) Pin
Mircea Neacsu26-Jun-21 1:25
Mircea Neacsu26-Jun-21 1:25 
You might be confused by a pair of spurious braces Smile | :)
#include <stdio.h>

int main(void)
{
    int x ; //This is the variable for being evaluated

    do
    {
    printf("Imput a figure between 1 y 8: ");
    scanf("%i", &x);

    }
    while ( x < 1 ||  x > 8 ); //This is a do...while statement.
                               //It repeats until x is between 1 AND 8

    { //this brace is not needed and might make you believe there is a while loop
        printf("Your imput was ::: %d ",x);
        printf("\n");

     } //closing brace that should also be removed
        printf("\n");

}


What the program does is to repeat the scanf statement until x is between 1 and 8.

Antoher way to explain it: the loop repeats until the condition is false. !( (x<1) || (x>8) ) is equivalent to !(x<1) && !(x>8) (see De Morgan's laws[^]), or (x>=1) && (x<=8).
Mircea

GeneralRe: Accurate interpretation and evaluation of this "or condition": while ( x < 1 || x > 8 ) Pin
Otto Medina26-Jun-21 18:51
Otto Medina26-Jun-21 18:51 

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.