#include <stdio.h>
int main()
{
char ch
;
printf("请输入一个小写字符:\n");
ch
= getchar();
ch
= ch
+ ('a' - 'A');
putchar(ch
);
printf("请输入一个小写字符:\n");
ch
= getchar();
putchar(ch
);
return 0;
}
#include <stdio.h>
int data1
, data2
;
char op
;
printf("please enter the expression data1+data2\n");
scanf_s("%d%c%d", &data1
, &op
, &data2
);
printf("%d%c%d = %d\n", data1
, op
, data2
, data1
+ data2
);
int a
;
char b
;
float c
;
printf("please input an integer:");
scanf_s("%d", &a
);
printf("integer: %d\n", a
);
printf("please input a character:");
scanf_s("%c", &b
);
printf("character: %c\n", b
);
printf("please input a float number:");
scanf_s("%f", &c
);
printf("float: %f\n", c
);
int a
;
char b
;
float c
;
printf("please input an integer:");
scanf_s("%d", &a
);
printf("integer: %d\n", a
);
getchar();
printf("please input a character:");
scanf_s("%c", &b
);
printf("character: %c\n", b
);
printf("please input a float number:");
scanf_s("%f", &c
);
printf("float: %f\n", c
);
int a
;
char b
;
float c
;
printf("please input an integer:");
scanf_s("%d", &a
);
printf("integer: %d\n", a
);
printf("please input a character:");
scanf_s(" %c", &b
);
printf("character: %c\n", b
);
printf("please input a float number:");
scanf_s("%f", &c
);
printf("float: %f\n", c
);
int a
;
char b
;
scanf("%d", &a
);
printf("%d\n", a
);
scanf("a %c", &b
);
printf("%c\n", b
);
return 0;
}
未完待续
---------------字符串处理仍有一组函数 及scanf
%s 格式符用法
转载请注明原文地址:https://tech.qufami.com/read-3980.html