程序问答   发布时间:2022-06-01  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了重新运行程序后(在 last 中输入 y for repeat in do while 后),它会自动取一个字符串大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决重新运行程序后(在 last 中输入 y for repeat in do while 后),它会自动取一个字符串?

开发过程中遇到重新运行程序后(在 last 中输入 y for repeat in do while 后),它会自动取一个字符串的问题如何解决?下面主要结合日常开发的经验,给出你关于重新运行程序后(在 last 中输入 y for repeat in do while 后),它会自动取一个字符串的解决方法建议,希望对你解决重新运行程序后(在 last 中输入 y for repeat in do while 后),它会自动取一个字符串有所启发或帮助;
//Write a program in c language to accept a String and reverse it without using strrev function of String.
#include <stdio.h>
#include <conio.h>
int main()
{
    int i,len = 0;
    char text[100],conTinue1;
    clrscr();
    do
    {
        printf("\nWrite the text to get its reverse: ");
        gets(text);
        for (i = 0; text[i] != NulL; i++)
            len = len + 1;
        printf("\nLength of String is %d\n",len);
        printf("Reverse of entered text is ");

        //reverse part
        while (len >= 0)
        {
            printf("%c",text[len]);
            len--;
        }
        printf("\npress y for conTinue or press any other key to exit: ");
        scanf(" %c",&conTinue1);
    } while (conTinue1 == 'y');
    printf("\nThanking You");
    return 0;
    getch();
}

仅在 y 表示程序第二次重复时才会产生问题。如果我输入任何其他字符作为输入,那么它会打印最后一部分并完成程序。 以下结果显示在控制台上。

Write the text to get its reverse: abc
Length of String is 3
Reverse of entered text is cba
press y for conTinue or press any other key to exit: y

Write the text to get its reverse:
Length of String is -1
Reverse of entered text is
press y for conTinue or press any other key to exit:

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

大佬总结

以上是大佬教程为你收集整理的重新运行程序后(在 last 中输入 y for repeat in do while 后),它会自动取一个字符串全部内容,希望文章能够帮你解决重新运行程序后(在 last 中输入 y for repeat in do while 后),它会自动取一个字符串所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。