标签:blank cccccc include 程序员 target
ios培训------我的c语言笔记,期待与您交流!
#include <stdio.h> int main() { /*1.算数运算符的基本使用 int a = 10 + 1 + 2 - 3 + 5; int b = -10; int c = 10 * b; int d = 10 / 2; int e = 10 % -3; // 取余运算(模运算) // %两边都是整数 // %取余结果的正负性只跟%左边的数值有关 printf("%d\n", e); //输出值:1 */ /* // 自动类型转换(double->int) int a = 10.8; // 强制类型转换(double->int) int b = (int) 10.5; printf("%d\n", a); //输出值:10 */ // 自动类型提升(int->double) double c = 10.6 + 6; printf("c的值是%f\n", c); //c的值是10.600000 double d = 3 / 2; printf("d的值是%f\n", d); //d的值是1.000000 double e= 10.0/4; printf("e的值是%f\n", e); //d的值是2.500000 double f= (double)3/2; printf("f的值是%f\n", f); //e的值是1.500000 return 0; }
标签:blank cccccc include 程序员 target
原文地址:http://putongren.blog.51cto.com/9086263/1626241