2 like 0 dislike
2.7k views

The 13-digit International Standard Book Number (ISBN) is a unique code that identifies a book commercially. The last digit is a check digit used for error detection. To calculate its value, each digit of the first twelve digits is alternately multiplied, from left to right, by 1 or 3. The products are summed up and divided by 10. The check digit is the remainder of the division subtracted from 10. If it is 10, it becomes 0. 

ISBN檢查號的計算方法: 前12個數字,奇數項 乘以 1 , 偶數項乘以 3

For example, assume that the first twelve digits are 978960931961.  

假設號碼前12位是978960931961

(a) (9*1 + 7*3 + 8*1 + 9*3 + 6*1 + 0*3 + 9*1 + 3*3 + 1*1 + 9*3 + 6*1 + 1*3) = 126 

(b) The check digit = 10 – (126 % 10) = 10 – 6 = 4  

檢查號 = 10 - 餘數 = 10 – (126 % 10) = 10 – 6 = 4  

So the valid ISBN is: 9789609319614

Write a program that reads a 13-digit ISBN and checks the last digit to see if it is valid or not. 

寫一個輸入13位ISBN號碼 判斷最後一個數字是否檢查碼即可

#Try 1:

Input:

9789609319614

Output: 

Valid ISBN

 

#Try 2:

Input:

9781482214505

Output: 

Valid ISBN

 

#Try 3:

Input:

9780132936493

Output: 

Invalid ISBN

 

[Exercise] Coding (C) - asked in Chapter 5: Selection Statements by (12.1k points)
ID: 27667 - Available when: Unlimited - Due to: Unlimited

edited by | 2.7k views

77 Answers

0 like 0 dislike
Hidden content!
#include <stdio.h>

int main()
{
    
    
* * *** * * * * *** isbn;
* ** *** * *** * ** ** * *** tot=0;
    
***** * * * ** ** * * ** * &isbn);
** * * *** ** ** * **** * * *** ****** * * **
    
** *** * *** ** * * * * * **** **
* ** ** * * * ******** ***** * ** ***
* * * *** * * ** * * *** ** *** ** **
* * * **** ** ** ***** * ** * * ***** ** *
* * * *** ** * ***** **** * ** ** *
** *** ** **** * * ** * *******
* *** * *** *** * * ** ** ** * * *
** * ** ** *** ** * * ** * **
* ** * ** * ** ** **** * ** **
* * * * * * * ** * * *** * * * *
****** * * * * * ****** *
*** *** ***** ** ****** * **
* *** *** * * ** **
* * *** ** **** *
* *** ** *** *** * * **
** * ******* * ******** = ** ** * *** ***** *** ** * * ** ***
    
*** * ** ****** **** * (10-(tot%10)==d13)
*** * * **** * ** * *
* * * * * ****** ** ** * * ** * **** *** ** * ** *** ISBN");
** *** * * ** *** **
    
* ** * *** ** * *** * * *** *
*** * *** *** * * * ** ** ** ***
* ****** * * * * ** * *** **** ***** ** * * * ** * ISBN");
* ** * ** ** ****** ** ** ***** **
    
***** * ***** ***** ** * 0;
}
answered by (323 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>

int main()
{
* * *** * * *** ** ** *** isbn;
* ** *** * ** * ** * sum1;
* * * *** *** ** ******* sum2;
* *** ** * * * ** sum3;
** * *** ** *** * *** * * ** sum4;
* *** ** *** *** * * * * *** sum5;
** ** * * ** * ** * * * * ** sum6;
* **** * ** ** ** * * * * sum7;
* * ** *** * * * ***** * sum8;
*** **** * * ** ** *** sum9;
* ** * ** ***** * ** * * sum10;
********* * * ** sum11;
** * ***** *** ** * **** sum12;
***** ***** * * * * * * sum13;
** * * * ** ******* * tt;
**** *** *** * * tt1;
    
***** *** *** * * * * * *** * * ***** * * * **
    
*** *** ***** ** ** * * * * *** * ** * *
** * * ******* * **** * * * * **** * ** *** *
* *** * * ** ** ** * ** * * ** * ** **** ** **** *** **
**** * * * * * * * * ** ** * ** *** * ** ** * ***
* * * *** * * * * * *** ** ** * * *** * * ** ** * * *** ***
* *** ** * * * ** ** *** * * **** **** * * **
***** * *** ** ****** ** * * ** ** * * *** *
** * * * **** * **** ** *** ** ** * * *
* * * * ** * ** * *** ***** * * * * * *** *
* * ** * * ** ** ** * * * * * ** ****
* *** * * ** ** ** * ** * *** ****
************** **** *** ** ** * ***** * **
* ** **** *** ** * **** ***** ** * **
    
* *** * ** ** * *** * ** *** * ***** * ** * * * * *
** * ** * ** * * * ** * * *
    
** * * * * ***** * * * * == sum13)
    {
**** *** * ***** **** * * ** * **** * * *** * ** ** ** ISBN");
    }
** ** * ** * ********* * ***
    {
* * ** ** ** * * ** **** ** ** * * * * * * ISBN");
    }

* * ** ** * * *** * * 0;
}
answered by (-193 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
#include * ** *
int main (void)
{
int * ** * * * ** ******
* * * *** ** %1d %1d %1d %1d %1d %1d %1d %1d %1d %1d %1d ** * * ** * ** ** ** * * * * * ***** *** **** * *** * ** ** * ***** *** *

* **** ** ** * ** * * * ***** ** **
 
* * ** (check==10) **** ** * * * ** *
check = 0;
* **
** * ***** * * **** ****
****
***** ** * * *
/*if ** ** * * **** **** *** * *
check = 0;*/

if (check==0) **** **** **
** ****
**** * * ** ** ** * * ***** *** * *** *
*** ** * * ** *
else * * **** * * * * ** ***** *
** ** ** **
* ** ****** *** * * *** *** ** * * *****
** * *
* ** ** *** 0;
}
answered by (-249 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
#include **** * * *
int main (void)
{
int * * * ** * *
** *** * %1d %1d %1d %1d %1d %1d %1d %1d %1d %1d %1d *** * *********** * ** ** ****** *** *** ** *** *** *** * * * ******* * **** ***** * * ****

** ***** ** *** *** ****
 
* * * (check==10) * ****** * * ** ** *
check = 0;
******
**** ** * ** * **** * **
* * *
** **** *
/*if **** **** ** ** * ** * * ** *
check = 0;*/

if (check==h) *** * ****
*** *** * *
* ** * * ****** ***** *** ** * **
** * * **
else *** * * ****
* *** *
*** *** ** * **** *** * ** ** **
** * *
***** **** 0;
}
answered by (-249 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Correct output
Case 3: Wrong output
0 like 0 dislike
Hidden content!
****** ** *
int main (void)
{
int * * ** * * * * * * * ** ** * * ** * * * * *** * * * *** * * *** * ** * ***** * * * * ** * * * * *** ***** ** *

** ***** + (d2*3) + (d3*1) + (d4*3) + **** + (d6*3) + (d7*1) + (d8*3) + (d9*1) + * *** + * + ** *

** * *

** * ** *    
*****
    * **** *** * *** * **
** *
* ** * * ** **
* * **** * *
** * ** * * *** * *** ****
** * ****
* * * **** 0;
}
answered by (-249 points)
0 0
prog.c: In function 'main':
prog.c:12:18: error: stray '\302' in program
  if (check==d13) \xc2\xa0\xc2\xa0\xc2\xa0
                  ^
prog.c:12:19: error: stray '\240' in program
  if (check==d13) \xc2\xa0\xc2\xa0\xc2\xa0
                   ^
prog.c:12:20: error: stray '\302' in program
  if (check==d13) \xc2\xa0\xc2\xa0\xc2\xa0
                    ^
prog.c:12:21: error: stray '\240' in program
  if (check==d13) \xc2\xa0\xc2\xa0\xc2\xa0
                     ^
prog.c:12:22: error: stray '\302' in program
  if (check==d13) \xc2\xa0\xc2\xa0\xc2\xa0
                      ^
prog.c:12:23: error: stray '\240' in program
  if (check==d13) \xc2\xa0\xc2\xa0\xc2\xa0
                       ^
prog.c:14:1: error: stray '\302' in program
 \xc2\xa0 \xc2\xa0 printf("Valid ISBN");
 ^
prog.c:14:2: error: stray '\240' in program
 \xc2\xa0 \xc2\xa0 printf("Valid ISBN");
  ^
prog.c:14:4: error: stray '\302' in program
 \xc2\xa0 \xc2\xa0 printf("Valid ISBN");
    ^
prog.c:14:5: error: stray '\240' in program
 \xc2\xa0 \xc2\xa0 printf("Valid ISBN");
     ^
prog.c:15:2: error: stray '\302' in program
  \xc2\xa0}
  ^
prog.c:15:3: error: stray '\240' in program
  \xc2\xa0}
   ^
prog.c:16:7: error: stray '\302' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0
       ^
prog.c:16:8: error: stray '\240' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0
        ^
prog.c:16:9: error: stray '\302' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0
         ^
prog.c:16:10: error: stray '\240' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0
          ^
prog.c:16:11: error: stray '\302' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0
           ^
prog.c:16:12: error: stray '\240' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0
            ^
prog.c:16:13: error: stray '\302' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0
             ^
prog.c:16:14: error: stray '\240' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0
              ^
prog.c:18:2: error: stray '\302' in program
  \xc2\xa0 \xc2\xa0printf("Invalid ISBN");
  ^
prog.c:18:3: error: stray '\240' in program
  \xc2\xa0 \xc2\xa0printf("Invalid ISBN");
   ^
prog.c:18:5: error: stray '\302' in program
  \xc2\xa0 \xc2\xa0printf("Invalid ISBN");
     ^
prog.c:18:6: error: stray '\240' in program
  \xc2\xa0 \xc2\xa0printf("Invalid ISBN");
      ^
0 like 0 dislike
Hidden content!
* * ** ** *****
int main (void)
{
int ***** * **** *** * ** * * *** * *** ** *** * *** * * *** ** ** ** ** ****** * ** *** ** ** * ** * ***** * * * * ** * * * * * * ** ** * **

* * * * + (d2*3) + + * * + (d5*1) + (d6*3) + (d7*1) + (d8*3) + (d9*1) + **** + * + ** *

******* *

if **** * ** *
** ****** ***** * *** *

** ** * * ** **** * **** * * ****
***** ** 0;
}
answered by (-249 points)
0 0
prog.c: In function 'main':
prog.c:12:18: error: stray '\302' in program
 if (dcheck==d13) \xc2\xa0\xc2\xa0\xc2\xa0
                  ^
prog.c:12:19: error: stray '\240' in program
 if (dcheck==d13) \xc2\xa0\xc2\xa0\xc2\xa0
                   ^
prog.c:12:20: error: stray '\302' in program
 if (dcheck==d13) \xc2\xa0\xc2\xa0\xc2\xa0
                    ^
prog.c:12:21: error: stray '\240' in program
 if (dcheck==d13) \xc2\xa0\xc2\xa0\xc2\xa0
                     ^
prog.c:12:22: error: stray '\302' in program
 if (dcheck==d13) \xc2\xa0\xc2\xa0\xc2\xa0
                      ^
prog.c:12:23: error: stray '\240' in program
 if (dcheck==d13) \xc2\xa0\xc2\xa0\xc2\xa0
                       ^
prog.c:13:1: error: stray '\302' in program
 \xc2\xa0{printf("Valid ISBN\n");}
 ^
prog.c:13:2: error: stray '\240' in program
 \xc2\xa0{printf("Valid ISBN\n");}
  ^
prog.c:15:7: error: stray '\302' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0{printf("Invalid ISBN\n");}
       ^
prog.c:15:8: error: stray '\240' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0{printf("Invalid ISBN\n");}
        ^
prog.c:15:9: error: stray '\302' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0{printf("Invalid ISBN\n");}
         ^
prog.c:15:10: error: stray '\240' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0{printf("Invalid ISBN\n");}
          ^
prog.c:15:11: error: stray '\302' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0{printf("Invalid ISBN\n");}
           ^
prog.c:15:12: error: stray '\240' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0{printf("Invalid ISBN\n");}
            ^
prog.c:15:13: error: stray '\302' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0{printf("Invalid ISBN\n");}
             ^
prog.c:15:14: error: stray '\240' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0{printf("Invalid ISBN\n");}
              ^
0 like 0 dislike
Hidden content!
** *** *** ** * * *
int main (void)
{
int * * ** * ***** **** ** **
**** * * *** * * **** ** * * * * *** ** * **** * **** ** ** * *** ** * ** **** ** ** ***** ** * *** ******** ****** **

** + (d2*3) + ** * + ** + (d5*1) + (d6*3) + (d7*1) + (d8*3) + (d9*1) + ** + *** + **** **

** * ****

** * * ******
** * **** **** *** ** *

* *** * ***
* ** * * * * ** ** * *** *
** 0;
}
answered by (-249 points)
0 0
prog.c: In function 'main':
prog.c:13:19: error: stray '\302' in program
  if (dcheck==d13) \xc2\xa0\xc2\xa0\xc2\xa0
                   ^
prog.c:13:20: error: stray '\240' in program
  if (dcheck==d13) \xc2\xa0\xc2\xa0\xc2\xa0
                    ^
prog.c:13:21: error: stray '\302' in program
  if (dcheck==d13) \xc2\xa0\xc2\xa0\xc2\xa0
                     ^
prog.c:13:22: error: stray '\240' in program
  if (dcheck==d13) \xc2\xa0\xc2\xa0\xc2\xa0
                      ^
prog.c:13:23: error: stray '\302' in program
  if (dcheck==d13) \xc2\xa0\xc2\xa0\xc2\xa0
                       ^
prog.c:13:24: error: stray '\240' in program
  if (dcheck==d13) \xc2\xa0\xc2\xa0\xc2\xa0
                        ^
prog.c:14:1: error: stray '\302' in program
 \xc2\xa0printf("Valid ISBN\n");
 ^
prog.c:14:2: error: stray '\240' in program
 \xc2\xa0printf("Valid ISBN\n");
  ^
prog.c:16:7: error: stray '\302' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0
       ^
prog.c:16:8: error: stray '\240' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0
        ^
prog.c:16:9: error: stray '\302' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0
         ^
prog.c:16:10: error: stray '\240' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0
          ^
prog.c:16:11: error: stray '\302' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0
           ^
prog.c:16:12: error: stray '\240' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0
            ^
prog.c:16:13: error: stray '\302' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0
             ^
prog.c:16:14: error: stray '\240' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0
              ^
0 like 0 dislike
Hidden content!
* * * * *
int main (void)
{
int * * * * * * ** * * * * * * ** * * ** ** * * * * * * **** * *** * * * *** * *** * * ******** *** ** ** * * * * * ** *** *** ** ** *** *

* **** ** ** + (d2*3) + (d3*1) + (d4*3) + (d5*1) + * + * + (d8*3) + *** + *** + * + *

** * **

if * == d13) * *
** * * ****

* * **** * ***** ** * ** ** * * 0;
answered by (-249 points)
0 0
prog.c: In function 'main':
prog.c:12:20: error: stray '\302' in program
 if (dcheck == d13) \xc2\xa0\xc2\xa0\xc2\xa0
                    ^
prog.c:12:21: error: stray '\240' in program
 if (dcheck == d13) \xc2\xa0\xc2\xa0\xc2\xa0
                     ^
prog.c:12:22: error: stray '\302' in program
 if (dcheck == d13) \xc2\xa0\xc2\xa0\xc2\xa0
                      ^
prog.c:12:23: error: stray '\240' in program
 if (dcheck == d13) \xc2\xa0\xc2\xa0\xc2\xa0
                       ^
prog.c:12:24: error: stray '\302' in program
 if (dcheck == d13) \xc2\xa0\xc2\xa0\xc2\xa0
                        ^
prog.c:12:25: error: stray '\240' in program
 if (dcheck == d13) \xc2\xa0\xc2\xa0\xc2\xa0
                         ^
prog.c:13:1: error: stray '\302' in program
 \xc2\xa0printf("Valid ISBN\n");
 ^
prog.c:13:2: error: stray '\240' in program
 \xc2\xa0printf("Valid ISBN\n");
  ^
prog.c:15:7: error: stray '\302' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0printf("Invalid ISBN\n"); return 0;
       ^
prog.c:15:8: error: stray '\240' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0printf("Invalid ISBN\n"); return 0;
        ^
prog.c:15:9: error: stray '\302' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0printf("Invalid ISBN\n"); return 0;
         ^
prog.c:15:10: error: stray '\240' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0printf("Invalid ISBN\n"); return 0;
          ^
prog.c:15:11: error: stray '\302' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0printf("Invalid ISBN\n"); return 0;
           ^
prog.c:15:12: error: stray '\240' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0printf("Invalid ISBN\n"); return 0;
            ^
prog.c:15:13: error: stray '\302' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0printf("Invalid ISBN\n"); return 0;
             ^
prog.c:15:14: error: stray '\240' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0printf("Invalid ISBN\n"); return 0;
              ^
prog.c:15:2: error: this 'else' clause does not guard... [-Werror=misleading-indentation]
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0printf("Invalid ISBN\n"); return 0;
  ^~~~
prog.c:15:41: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'else'
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0printf("Invalid ISBN\n"); return 0;
                                         ^~~~~~
prog.c:15:2: error: expected declaration or statement at end of input
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0printf("Invalid ISBN\n"); return 0;
  ^~~~
cc1: all warnings being treated as errors
0 like 0 dislike
Hidden content!
** * ** * * *
int main (void)
{
int *** * * * ***** * ****** ** * * * * * * ** ** * * * * * ** * * * * ****** * ** * * ** ** ** ** ** * ***** * * ** ** * ** ** * * * ** * ** *****

* ** * + (d2*3) + (d3*1) + (d4*3) + (d5*1) + * + * + (d8*3) + + * + ** + *

** * ** *

if ** == d13) **
******* ** * *** * ****

* * ** * * * * ** * * * 0;
answered by (-249 points)
0 0
prog.c: In function 'main':
prog.c:12:20: error: stray '\302' in program
 if (dcheck == d13) \xc2\xa0\xc2\xa0\xc2\xa0
                    ^
prog.c:12:21: error: stray '\240' in program
 if (dcheck == d13) \xc2\xa0\xc2\xa0\xc2\xa0
                     ^
prog.c:12:22: error: stray '\302' in program
 if (dcheck == d13) \xc2\xa0\xc2\xa0\xc2\xa0
                      ^
prog.c:12:23: error: stray '\240' in program
 if (dcheck == d13) \xc2\xa0\xc2\xa0\xc2\xa0
                       ^
prog.c:12:24: error: stray '\302' in program
 if (dcheck == d13) \xc2\xa0\xc2\xa0\xc2\xa0
                        ^
prog.c:12:25: error: stray '\240' in program
 if (dcheck == d13) \xc2\xa0\xc2\xa0\xc2\xa0
                         ^
prog.c:13:1: error: stray '\302' in program
 \xc2\xa0printf("Valid ISBN\n");
 ^
prog.c:13:2: error: stray '\240' in program
 \xc2\xa0printf("Valid ISBN\n");
  ^
prog.c:15:7: error: stray '\302' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0printf("Invalid ISBN\n"); return 0;
       ^
prog.c:15:8: error: stray '\240' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0printf("Invalid ISBN\n"); return 0;
        ^
prog.c:15:9: error: stray '\302' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0printf("Invalid ISBN\n"); return 0;
         ^
prog.c:15:10: error: stray '\240' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0printf("Invalid ISBN\n"); return 0;
          ^
prog.c:15:11: error: stray '\302' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0printf("Invalid ISBN\n"); return 0;
           ^
prog.c:15:12: error: stray '\240' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0printf("Invalid ISBN\n"); return 0;
            ^
prog.c:15:13: error: stray '\302' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0printf("Invalid ISBN\n"); return 0;
             ^
prog.c:15:14: error: stray '\240' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0printf("Invalid ISBN\n"); return 0;
              ^
prog.c:15:2: error: this 'else' clause does not guard... [-Werror=misleading-indentation]
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0printf("Invalid ISBN\n"); return 0;
  ^~~~
prog.c:15:41: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'else'
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0printf("Invalid ISBN\n"); return 0;
                                         ^~~~~~
prog.c:15:2: error: expected declaration or statement at end of input
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0printf("Invalid ISBN\n"); return 0;
  ^~~~
cc1: all warnings being treated as errors
0 like 0 dislike
Hidden content!
* * ** * ***
int main *** *
{
int *** * * ** *** ** * ****** *** * *** *** * **** ** *** * *** * * ***** *** * * * * * * * * * ** * * ** * ** ** *** ** ** *** ** ** *** * *

*** **** ***** + * *** + * * + (d4*3) + (d5*1) + (d6*3) + * + ** + * + *** * + ** + *** **

*** * * **

if * == 10) *** * = 0;

if **** ** == d13) ***
*** *** *** * * *** *

* * * **** ***** ****** * * ** return 0;
answered by (-249 points)
0 0
prog.c: In function 'main':
prog.c:10:19: error: stray '\302' in program
 if (dcheck == 10) \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0dcheck = 0;
                   ^
prog.c:10:20: error: stray '\240' in program
 if (dcheck == 10) \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0dcheck = 0;
                    ^
prog.c:10:21: error: stray '\302' in program
 if (dcheck == 10) \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0dcheck = 0;
                     ^
prog.c:10:22: error: stray '\240' in program
 if (dcheck == 10) \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0dcheck = 0;
                      ^
prog.c:10:23: error: stray '\302' in program
 if (dcheck == 10) \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0dcheck = 0;
                       ^
prog.c:10:24: error: stray '\240' in program
 if (dcheck == 10) \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0dcheck = 0;
                        ^
prog.c:10:25: error: stray '\302' in program
 if (dcheck == 10) \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0dcheck = 0;
                         ^
prog.c:10:26: error: stray '\240' in program
 if (dcheck == 10) \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0dcheck = 0;
                          ^
prog.c:12:20: error: stray '\302' in program
 if (dcheck == d13) \xc2\xa0\xc2\xa0\xc2\xa0
                    ^
prog.c:12:21: error: stray '\240' in program
 if (dcheck == d13) \xc2\xa0\xc2\xa0\xc2\xa0
                     ^
prog.c:12:22: error: stray '\302' in program
 if (dcheck == d13) \xc2\xa0\xc2\xa0\xc2\xa0
                      ^
prog.c:12:23: error: stray '\240' in program
 if (dcheck == d13) \xc2\xa0\xc2\xa0\xc2\xa0
                       ^
prog.c:12:24: error: stray '\302' in program
 if (dcheck == d13) \xc2\xa0\xc2\xa0\xc2\xa0
                        ^
prog.c:12:25: error: stray '\240' in program
 if (dcheck == d13) \xc2\xa0\xc2\xa0\xc2\xa0
                         ^
prog.c:13:1: error: stray '\302' in program
 \xc2\xa0printf("Valid ISBN\n");
 ^
prog.c:13:2: error: stray '\240' in program
 \xc2\xa0printf("Valid ISBN\n");
  ^
prog.c:15:7: error: stray '\302' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0printf("Invalid ISBN\n"); return 0;
       ^
prog.c:15:8: error: stray '\240' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0printf("Invalid ISBN\n"); return 0;
        ^
prog.c:15:9: error: stray '\302' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0printf("Invalid ISBN\n"); return 0;
         ^
prog.c:15:10: error: stray '\240' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0printf("Invalid ISBN\n"); return 0;
          ^
prog.c:15:11: error: stray '\302' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0printf("Invalid ISBN\n"); return 0;
           ^
prog.c:15:12: error: stray '\240' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0printf("Invalid ISBN\n"); return 0;
            ^
prog.c:15:13: error: stray '\302' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0printf("Invalid ISBN\n"); return 0;
             ^
prog.c:15:14: error: stray '\240' in program
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0printf("Invalid ISBN\n"); return 0;
              ^
prog.c:15:2: error: this 'else' clause does not guard... [-Werror=misleading-indentation]
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0printf("Invalid ISBN\n"); return 0;
  ^~~~
prog.c:15:41: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'else'
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0printf("Invalid ISBN\n"); return 0;
                                         ^~~~~~
prog.c:15:2: error: expected declaration or statement at end of input
  else \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0printf("Invalid ISBN\n"); return 0;
  ^~~~
cc1: all warnings being treated as errors
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:108.162.216.55
©2016-2024

Related questions

0 like 0 dislike
26 answers
[Exam] asked Dec 9, 2017 in Midterm by thopd (12.1k points)
ID: 36751 - Available when: 2017-11-15 14:10 - Due to: Unlimited
| 1k views
1 like 1 dislike
49 answers
[Exam] asked Nov 15, 2017 in Midterm by thopd (12.1k points)
ID: 32706 - Available when: 2017-11-15 14:10 - Due to: Unlimited
| 1.6k views
12,783 questions
183,443 answers
172,219 comments
4,824 users