C语言FOR循环有AM和CHAR

C语言FOR循环有AM和CHAR,第1张

11 第一次循环 p=s 输出为9876

第二次循环 p=s+1 输出为改亩876

然后p=s+2 不满足条件p<s+2 退出循环

12 a=p1==&m 因为p1=&k 所以判断不成立,a=0

b=(*p1)/(*p2)+7=k/m+7=4/6+7=7

于是型歼液执行后

a值为卜物0 b值为7

#include<stdio.h>

#include<string.h>

int main(){

        int i = 0

        char ch[3][100]

        char max[100]

        for( 并源或i <裂纳 3 ++i)

         绝伍       scanf("%s", ch[i])

        strcpy(max, ch[0])

        for(i = 1 i < 3 ++i)

                if(strcmp(max, ch[i]) < 0)

                        strcpy(max, ch[i])

        printf("the max string is : %s", max)

        return 0

}

#include<stdio.h>

#include<string.h>

#include<ctype.h>

//有一篇文章,共有三行字符,每行80个字符,分别统计其中英文大写字母,小写字母,数字,空格以及其他字符的个数

void calc(char ch[3][80], int col){

int i = 0, j = 9, upp_cnt, low_cnt, num_cnt, space_cnt, other_cnt

upp_cnt = low_cnt = num_cnt = space_cnt = other_cnt = 0

for( i < col  ++i)

for(j = 0 j < 80 ++j){

if(isupper(ch[i][j]))

upp_cnt++

else if(islower(ch[i][j]))

low_cnt++

else if(' ' == ch[i][j])

space_cnt++

else if (isdigit(ch[i][j]))

num_cnt++

else

other_cnt++

}

printf("upper count : %d\n",upp_cnt )

printf("lower count : %d\n",low_cnt )

printf("space count : %d\n",space_cnt )

printf("nun count : %d\n",num_cnt )

printf("other count : %d\n",other_cnt )

}

int main(){

char ch[3][80] = {

   {"Hello, my name is Ann. I'm taking an American accent training."},

     {"And I have paid $ 100. I think I can do it. So insist it."},

           {"Now I am making a programming and I want to mannage it."}

}

calc(ch, 3)

return 0

}

这些都是很基础的,希望LZ好好学习,不要谈恋爱了


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/12557717.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-26
下一篇 2023-05-26

发表评论

登录后才能评论

评论列表(0条)

保存