| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 982 人关注过本帖
标题:(编译和链接都没有问题)是不是循环有问题啊???求解。。。
只看楼主 加入收藏
学初
Rank: 2
等 级:论坛游民
帖 子:11
专家分:27
注 册:2016-5-12
结帖率:100%
收藏
已结贴  问题点数:10 回复次数:1 
(编译和链接都没有问题)是不是循环有问题啊???求解。。。
/*对字符串中的大小写字符进行转换*/

#include "stdio.h"
#include "ctype.h"
void str_toupper(char*s);
void str_tolower(char*s);
int main(void)
{
    char*s="ABcd";

    str_toupper(s);
    printf("%s\n",s);

    str_tolower(s);
    printf("%s\n",s);

    return 0;
}

void str_toupper(char*s)
{
    int i=0;

    while(*(s+i)){
        *(s+i)=toupper(*(s+i));
        i++;
    }
}

void str_tolower(char*s)
{
    int i=0;

    while(*(s+i)){
        *(s+i)=tolower(*(s+i));
        i++;
    }
}
搜索更多相关主题的帖子: include return 字符串 
2016-05-31 22:49
alice_usnet
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:18
帖 子:370
专家分:2020
注 册:2016-3-7
收藏
得分:10 
#include "stdio.h"
#include "ctype.h"
void str_toupper(char*s);
void str_tolower(char*s);
int main(void)
{
    /*char*s="ABcd";*/
    char s[]="ABcd";
    str_toupper(s);
    printf("%s\n",s);

    str_tolower(s);
    printf("%s\n",s);

    return 0;
}

void str_toupper(char*s)
{
    int i=0;

    while(*(s+i)){
        *(s+i)=toupper(*(s+i));
        i++;
    }
}

void str_tolower(char*s)
{
    int i=0;

    while(*(s+i)){
        *(s+i)=tolower(*(s+i));
        i++;
    }
}

未佩好剑,转身便已是江湖
2016-05-31 23:36
快速回复:(编译和链接都没有问题)是不是循环有问题啊???求解。。。
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.040470 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved