num20 = dollar/20;
num10 = (dollar - 20*num20)/10;
num5 =(dollar-20*num20-10*num10)/5;//可以写为num5 = (dollar%10)/5;
num1=dollar-20*num20-10*num10-5*num5;//num1=dollar%10-5*num5;
十位为7的数 算法:
(num6/10)%10!=7
整数除于整数仍是整数
例:
5*12/7==7
ASCII码值
65–90 A—Z
97–122 a—z
48–57 0—9
%g用来省去无效的零
%.xf保留x位小数点后位数
/*
编写一个函数char_contains(char str[],char c),
如果字符串str中包含字符c则返回数值1,否则返回数值0
*/
编写一个函数char_contains(char str[],char c),
如果字符串str中包含字符c则返回数值1,否则返回数值0
*/
int char_contains(char str[], char c)
{
int i = -1;
// 1.遍历整个字符串
while ( str[++i] != c && str[i] != '\0' ) ;
//return str[i] == '\0' ? 0 : 1;
return str[i] != '\0';
}
{
int i = -1;
// 1.遍历整个字符串
while ( str[++i] != c && str[i] != '\0' ) ;
//return str[i] == '\0' ? 0 : 1;
return str[i] != '\0';
}