C语言实验1
代码1:SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。
// 1.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "stdio.h" int main(int argc, char* argv[]) { int a,b,sum; a = 123; b = 456; sum = a+b; printf("sum is %d\n",sum); return 0; }
代码2: // 实验1.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "stdio.h" int main(int argc, char* argv[]) { char c1,c2; c1=97; c2=98; printf("c1=%c,c2=%c\n",c1,c2); printf("c1=%d,c2=%d\n",c1,c2); return 0; }
代码3: // sy2.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "stdio.h" int main(int argc, char* argv[]) { char c1,c2; c1=197; c2=198; printf("c1=%c,c2=%c\n",c1,c2); printf("c1=%d,c2=%d\n",c1,c2); return 0; }
代码4: // sy2.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "stdio.h" #include "math.h" int main(int argc, char* argv[]) { double x,y,z; scanf("%lf %lf",&x,&y); z=x+1/abs(y); printf("z=%d\n",(int)z); printf("z=%15.6lf\n",z); printf("z=%e\n",z); return 0; }

更多精彩