C++ 中的空格

C++ 中的空格
只包含空格的行,被称为空白行,可能带有注释,C++ 编译器会完全忽略它。

在 C++ 中,空格用于描述空白符、制表符、换行符和注释。空格分隔语句的各个部分,让编译器能识别语句中的某个元素(比如 int)在哪里结束,下一个元素在哪里开始。

 1 #include <iostream>
 2 #include <cmath>
 3 /* run this program using the console pauser or add your own getch, system("pause") or input loop */
 4 using namespace std;
 5 int main(int argc, char** argv) {
 6     float a,b,c,x1,x2;
 7     cin >>a >>b >>c;
 8     x1=(-b+sqrt(b*b-4*a*c))/(2*a);
 9     x2=(-b-sqrt(b*b-4*a*c))/(2*a);
10     cout <<"x1=" <<x1 <<endl;
11     cout <<"x2=" <<x2 <<endl;
12     return 0;
13 }

 

posted @ 2018-08-01 14:02  borter  阅读(3439)  评论(0编辑  收藏  举报