#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main()
{
int a, b, x, y, c, d;
scanf("%d,%d" ,&a, &b);
x = a + b;
y = a - b;
c = a * b;
printf("a+b=%d\n", x);
printf("a-b=%d\n", y);
printf("a*b=%d\n", c);
if (b == 0)
printf("error\n");
else
{
d = a / b;
printf("a/b=%d\n", d);
}
return 0;
}
#include <stdio.h>
int main(void)
{
int i = 6, j = 12, k;
double x = 3.28, y = 90;
k = j + 87;
printf("i=%d j=%c\n", i, k);
printf("x=%7.6e y=%2.0f\n", x, y);
return 0;
}
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main(void)
{
int l, y;
float a, b, w1, w2;
scanf("%f,%f,%d,%d", &a, &b, &l, &y);
w1 = (a - b) / l;
w2 = a - w1 * y;
printf("%.2f,%.2f\n", w1, w2);
return 0;
}
#include <stdio.h>
int main(void)
{
char c1 = 'C', c2 = 'h', c3 = 'i', c4 = 'n', c5 = 'a';
printf("%c%c%c%c%c\n", c1, c2, c3, c4, c5);
c1 += 4;
c2 += 4;
c3 += 4;
c4 += 4;
c5 += 4;
printf("%c%c%c%c%c\n", c1, c2, c3, c4, c5);
return 0;
}
总结:
熟练使用_CRT_SECURE_NO_WARNINGS;
在实践中注意浮点型和整型的使用区别;
练习“%”的使用;
了解 char 只能存放一个字符;
熟悉字符通过Ascii码进行转换的运算;
熟悉数据类型的转换;
熟练 += 符号的运用。