本文目录一览

1,请问学编程需要背什么公式

编程你背不起,不说别的,易语言你就背不起,理解着去尝试,做多就好。
个人感觉靠背诵学出来的都是机器猪
我是零基础,很想学

请问学编程需要背什么公式

2,编程小知识

scanf("%lf",&x)如果x成功读入,其返回值就为1,scanf("%lf",&x)==1是为了检查scanf是否成功读入了x,那么while(scanf("%lf",&x)==1);这句话是说,如果成功读入x,条件表达式为真,循环继续,等待下一个输入;如果读入x失败,或没有输入,则退出循环。参考资料:关于scanf的返回值,MSDN里是这样写的:Both scanf and wscanf return the number of fields successfully convertedand assigned; the return value does not include fields that were read but not assigned. A return value of 0 indicates that no fields were assigned. The return value is EOF for an error or if the end-of-file character or the end-of-string character is nocountered in the first attempt to read a character.如:scanf("%d%d", &a, &b);如果a和b都被成功读入,那么scanf的返回值就是2如果只有a被成功读入,返回值为1如果a和b都未被成功读入,返回值为0如果遇到错误或遇到end of file,返回值为EOF。
如果 输入的数(x)等于1,那么.... ,随时判断输入的数值进行其他操作。
倒!SCANF函数是个输入函数,但他外面的WHILE函数是个循环函数,这个的意思就是当SCANF输入的值为1时......
没有一个人会去教单独一个新手的,想学编程知识,我建议你多去去一些类是 www.csdn.net www.javaeye.com 这样的网站学习!

编程小知识

3,C语言基础编程

#include#include void main() { float a=3.0,b=4.0,c=5.0,s; s=(a+b+c)*0.5; s=sqrt(s*(s-a)*(s-b)*(s-c)); printf("面积:%f",s); }
一楼的不行,二楼的比较好,用二楼的吧!
如果你要求边长为3,4,5的三角形面积,运行程序后输入3 4 5即可 以下为程序源代码,已通过编译调试,可运行: #include "stdio.h" #include "math.h" int main() { double a , b , c; //边长为a,b,c double l; //l = ( a + b + c ) / 2 double s; //面积 printf( "Please input sides of triangle a,b,c: " ); scanf( "%lf %lf %lf" , &a , &b , &c ); if ( a + b > c && a + c > b && b + c > a ) //判断是否符合构成一个三角形的条件 { l = ( a + b + c ) / 2; //求l s = sqrt( l * ( l - a ) * ( l - b ) * ( l - c ) ); //求s printf( "The area of triangle is: %.3f\n" , s ); //打印s } else { printf( "Invalid sides!\n" ); //输入不合法 } return 0; }
#include #include main(){ float a,b,c,s,S; a=3; b=4; c=5; s=(1.0/2.0)*(a+b+c); s=(s*(s-a)*(s-b)*(s-c)); S=sqrt(s); printf("%f",S); }
#include#include int main() { int a=3,b=4,c=5; float s; s=(a+b+c)*0.5; s=s*(s-a)*(s-b)*(s-c); s=sqrt(s); printf("三角形面积是%f:",s); return 0; }

C语言基础编程


文章TAG:编程  编程基础  基础  公式  编程基础公式  
下一篇