C++ 注释
程序的注释是解释性语句,您可以在 C++ 代码中包含注释,这将提高源代码的可读性。所有的编程语言都允许某种形式的注释。
C++ 支持单行注释和多行注释。注释中的所有字符会被 C++ 编译器忽略。
1 #include <iostream> 2 3 /* run this program using the console pauser or add your own getch, system("pause") or input loop */ 4 #include<cmath> 5 #include<iomanip> 6 using namespace std; 7 int main(int argc, char** argv) { 8 double a,b,c; 9 cout <<"plese enter a,b,c:"; 10 cin >>a >>b >>c; 11 if(a+b>c&&b+c>a&&c+a>b) 12 { 13 double s,area; 14 s=(a+b+c)/2; 15 area=sqrt(s*(s-a)*(s-b)*(s-c)); 16 cout <<setiosflags(ios::fixed)<<setprecision(4); 17 cout<<"area="<<area<<endl; 18 } 19 else cout <<"it is not a trilateral!"<<endl; 20 return 0; 21 }