user-0 提问: 用vs2015运行冒泡排序哪里不对吗？

回复:
user: user-0
content: 引用 9 楼 csucxy 的回复：难道现在的C语言教材会不讲注释吗？尽管//注释形式来源于C++，但C标准早就接过去了啊。 6.4.9 Comments 1 Except within a character constant, a string literal, or a comment, the characters /* introduce a comment. The contents of such a comment are examined only to identify multibyte characters and to find the characters */ that terminate it.83) 2 Except within a character constant, a string literal, or a comment, the characters // introduce a comment that includes all multibyte characters up to, but not including, the next new-line character. The contents of such a comment are examined only to identify multibyte characters and to find the terminating new-line character.感谢，已经可以了

user: user-0
content: 去掉for后面不该有的分号；后依然是一样的编译结果

user: user-0
content: 引用 9 楼 csucxy 的回复：难道现在的C语言教材会不讲注释吗？尽管//注释形式来源于C++，但C标准早就接过去了啊。 6.4.9 Comments 1 Except within a character constant, a string literal, or a comment, the characters /* introduce a comment. The contents of such a comment are examined only to identify multibyte characters and to find the characters */ that terminate it.83) 2 Except within a character constant, a string literal, or a comment, the characters // introduce a comment that includes all multibyte characters up to, but not including, the next new-line character. The contents of such a comment are examined only to identify multibyte characters and to find the terminating new-line character.去掉分号了也是不行。我用的vs2015

user: user-1
content: 别人帮你注释掉不该有的;，是为了让你看更清楚哪有不对。注释一般是作用是注释说明程序，由于被注释的内容将不参与编译，从编译的角度上来说就相当于删除了它。

user: user-0
content: //后面跟；是用来解释什么

user: user-1
content: 难道现在的C语言教材会不讲注释吗？尽管//注释形式来源于C++，但C标准早就接过去了啊。 6.4.9 Comments 1 Except within a character constant, a string literal, or a comment, the characters /* introduce a comment. The contents of such a comment are examined only to identify multibyte characters and to find the characters */ that terminate it.83) 2 Except within a character constant, a string literal, or a comment, the characters // introduce a comment that includes all multibyte characters up to, but not including, the next new-line character. The contents of such a comment are examined only to identify multibyte characters and to find the terminating new-line character.

user: user-1
content: #include <stdio.h>  int main() {     int a[10];     int i, j, t;     printf("input 10 numbers:\n");      for (i = 0; i < 10; i++)     {         scanf_s("%d", &a[i]);     }      printf("\n");      for (j = 0; j < 9; j++)     {         for (i = 0; i < 9 - j; i++)         {             if (a[i] < a[i + 1])             {                 t = a[i], a[i] = a[i + 1], a[i + 1] = t;             }         }     }     printf("number:\n");      for (i = 0; i < 10; i++)     {         printf("%d ", a[i]);     }     printf("\n");      system("pause");      return 0; } 你确定会一样？

user: user-0
content: 将for后面的分号去掉了也是一样的结果

user: user-2
content: for循环后的分号都去掉就好了

user: user-1
content: 你为什么在for后面加分号？

user: user-0
content: 引用 7 楼 自信男孩 的回复:#include <stdio.h> int main(void) {     int a[10];     int i, j, t;     printf("input 10 numbers:\n");     for (i = 0; i < 10; i++)//;         scanf_s("%d", &a[i]);     printf("\n");     for (j = 0; j < 9; j++)//;     for (i = 0; i < 9 - j; i++)//;     if (a[i]<a[i+1])     {         t = a[i], a[i] = a[i + 1], a[i + 1] = t;     }     printf("number:\n");     for (i = 0; i < 10; i++)         printf("%d", a[i]);     printf("\n");     system("pause");     return 0; }   供参考～ 加//是用来做什么的？

user: user-3
content: #include <stdio.h> int main(void) {     int a[10];     int i, j, t;     printf("input 10 numbers:\n");     for (i = 0; i < 10; i++)//;         scanf_s("%d", &a[i]);     printf("\n");     for (j = 0; j < 9; j++)//;     for (i = 0; i < 9 - j; i++)//;     if (a[i]<a[i+1])     {         t = a[i], a[i] = a[i + 1], a[i + 1] = t;     }     printf("number:\n");     for (i = 0; i < 10; i++)         printf("%d", a[i]);     printf("\n");     system("pause");     return 0; }   供参考～

user: user-4
content: for后面的分号改括号

user: user-0
content: 在每个for和if后面加上{}就好了。谢谢