Home > Back-end >  Ask is what is going wrong
Ask is what is going wrong

Time:01-21

To debug a great god help me to change it according to the flowchart

# include
# include
# include

Int main (void)
{
Int retry=0;
Int card;
srand(time(NULL));
Int card=rand () % + 1;
Printf (" card=% d \ n ", card);
If (card & gt; 21) {
The switch (card) {
If (card==1) {
Printf (" あ な た の wins ち \ n ");
break;
}
The else {
Printf (" あ な た の negative け \ n ");
break;
}
}
}
Printf (" も う once カ ー ド を lead く か confirmed \ n ");
Printf (" retry を し into force て く だ さ い, \ n ");

Scanf_s (" % d ", & amp; Retry);
The switch (retry)
{
If (retry==0) {
break;
}
} while (card);
return 0;
}

CodePudding user response:

Look not to understand Japanese, can only be amended from the grammar errors, for reference:
 # include 
# include
# include

Int main (void)
{
Int retry=0;
Int card;//here have defined the card
srand(time(NULL));
Card=rand () % + 1;//int card=rand () % + 1;
Printf (" card=% d \ n ", card);

If (card & gt; 21) {
The switch (card) {
If (card==1) {//never satisfied the condition here
Printf (" あ な た の wins ち \ n ");
break;
}
The else {
Printf (" あ な た の negative け \ n ");
break;
}
}
}
Printf (" も う once カ ー ド を lead く か confirmed \ n ");
Printf (" retry を し into force て く だ さ い, \ n ");

The scanf (" % d ", & amp; Retry);//scanf_s (" % d ", & amp; Retry);
The switch (retry) {
If (retry==0) {
break;
}
} while (retry);//while (card);//? Here is the infinite loop

return 0;
}

CodePudding user response:

reference 1st floor QZJHJXJ response:
don't understand Japanese, can only be amended from the grammar errors, for reference:
 # include 
# include
# include

Int main (void)
{
Int retry=0;
Int card;//here have defined the card
srand(time(NULL));
Card=rand () % + 1;//int card=rand () % + 1;
Printf (" card=% d \ n ", card);

If (card & gt; 21) {
The switch (card) {
If (card==1) {//never satisfied the condition here
Printf (" あ な た の wins ち \ n ");
break;
}
The else {
Printf (" あ な た の negative け \ n ");
break;
}
}
}
Printf (" も う once カ ー ド を lead く か confirmed \ n ");
Printf (" retry を し into force て く だ さ い, \ n ");

The scanf (" % d ", & amp; Retry);//scanf_s (" % d ", & amp; Retry);
The switch (retry) {
If (retry==0) {
break;
}
} while (retry);//while (card);//? Here is the infinite loop

return 0;
}
I direct messages you brother
  • Related