摘要: for语句跟while语句差不多,如果题目中指定了循环次数,用for更清晰,循环的四个组成一目了然;其他条件下多使用while语句 这是一个判断输入的数共有几位的程序。 阅读全文
posted @ 2018-08-10 12:49 a_chang 阅读(298) 评论(0) 推荐(0) 编辑
摘要: #include int main() { double x,y; printf("Enter x (x>=0)\n"); scanf("%lf",&x); if (x<=15){y=4*x/3;} else{y=2.5*x-10.5;} printf("y=f(%f)=%.2f\n",x,y); } 阅读全文
posted @ 2018-08-10 10:09 a_chang 阅读(4673) 评论(0) 推荐(0) 编辑
摘要: 每句之后一定要加“;”,好多次都忘掉。 阅读全文
posted @ 2018-08-10 10:00 a_chang 阅读(9561) 评论(0) 推荐(0) 编辑