求大神指导C语言中的一些问题

哎呦鱼儿 2013-08-05 12:19:57
我想用C 编写一个程序 来讲一段故事,
第一,例如 "请你输入您的名字 "
"请你输入他的名字 "
如何先后显示出来
第二 讲故事阶段 如何将汉字一个一个的打出来
求指导呀 各位师兄师姐们!可能是大叔姐姐们。。
...全文
188 15 打赏 收藏 转发到动态 举报
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhctj159 2013-08-06
  • 打赏
  • 举报
回复
引用 14 楼 zhao4zhong1 的回复:
[quote=引用 7 楼 zhctj159 的回复:] 赵老师修改版
#include <stdio.h>
#include <locale.h>
#include <windows.h>
char abc[] = "在很久很久以前,记得那是1968年……";
int L,i;
int main(){
	L=strlen(abc);
    for (i=0;i<L;i++) {
		printf("%c",abc[i]);
        Sleep(300);
    }
修改本ID的代码,是要吃亏的。(通常本ID的代码每个字符都有其用途。)[/quote]不怕不怕,不求通用,但求简单易懂、、
赵4老师 2013-08-06
  • 打赏
  • 举报
回复
引用 7 楼 zhctj159 的回复:
赵老师修改版
#include <stdio.h>
#include <locale.h>
#include <windows.h>
char abc[] = "在很久很久以前,记得那是1968年……";
int L,i;
int main(){
	L=strlen(abc);
    for (i=0;i<L;i++) {
		printf("%c",abc[i]);
        Sleep(300);
    }
修改本ID的代码,是要吃亏的。(通常本ID的代码每个字符都有其用途。)
常如意 2013-08-06
  • 打赏
  • 举报
回复
#include<stdio.h> #include<string.h> #include <unistd.h> char story[2000] = { "There was once on a time a little girl whose father and mother were dead, and she was so poor \ that she no longer had any little room to live in, or bed to sleep in, and at last she had nothing\ else but the clothes she was wearing and a little bit of bread in her hand which some charitable\ soul had given her. She was, however, good and pious. " }; int main() { char name[10]; int i; printf("please input your name\n"); scanf("%s", name); for (i=0;i<strlen(story);i++) { printf("%c",story[i]); usleep(10000); } return 0; }
在河之洲 2013-08-06
  • 打赏
  • 举报
回复
楼上说的极是啊
倒在四百页 2013-08-06
  • 打赏
  • 举报
回复
引用 1 楼 u011542768 的回复:
还有 在一个程序最后修改一下 只有输入两个固定的名字 才能够结束程序,改怎么修改?
	while (name1 != "mingzi1" || name2 != "mingzi2")
	{
		
	}
mingzi1, mingzi2是固定名字
max_min_ 2013-08-05
  • 打赏
  • 举报
回复
引用 4 楼 u011542768 的回复:
好嘛。。。我现在是在自学的 就是想多问问
你依照这个格式写吧,多练习多实践

#include <stdio.h>

int main(void)
{
    char name[36] = {0} 
    printf("请输入你的名字:\n");

    scanf("%s", name);

    printf("名字是:%s\n", name);


    return 0;
}
赵4老师 2013-08-05
  • 打赏
  • 举报
回复
#include <stdio.h>
#include <locale.h>
#include <windows.h>
wchar_t w[]=L"在很久很久以前,记得那是1968年……";
int L,i;
int main() {
    setlocale(LC_ALL,"chs");
    L=wcslen(w);
    for (i=0;i<L;i++) {
        wprintf(L"%c",w[i]);
        fflush(stdout);
        Sleep(300);
    }
    return 0;
}
哎呦鱼儿 2013-08-05
  • 打赏
  • 举报
回复
好嘛。。。我现在是在自学的 就是想多问问
xiaoliang1201 2013-08-05
  • 打赏
  • 举报
回复
ls说得对,这个都是C语言的基础。看一下C相关的书籍就会了。
max_min_ 2013-08-05
  • 打赏
  • 举报
回复

都是基础题目,
太基础了,楼主看看书吧!c primer plus 看完2章就会了

授人以鱼,不如授人以渔阿

哎呦鱼儿 2013-08-05
  • 打赏
  • 举报
回复
还有 在一个程序最后修改一下 只有输入两个固定的名字 才能够结束程序,改怎么修改?
一根烂笔头 2013-08-05
  • 打赏
  • 举报
回复
引用 4 楼 u011542768 的回复:
好嘛。。。我现在是在自学的 就是想多问问
恩,那作为你实现的一个小目标吧!看学完C后能不能写出来!
max_min_ 2013-08-05
  • 打赏
  • 举报
回复
引用 8 楼 u011542768 的回复:
谢谢你们啦!~
问题解决了,左下角或者左上角 有结贴按钮,方便论坛更新管理! 结贴是个好习惯啊
哎呦鱼儿 2013-08-05
  • 打赏
  • 举报
回复
谢谢你们啦!~
zhctj159 2013-08-05
  • 打赏
  • 举报
回复
赵老师修改版
#include <stdio.h>
#include <locale.h>
#include <windows.h>
char abc[] = "在很久很久以前,记得那是1968年……";
int L,i;
int main(){
	L=strlen(abc);
    for (i=0;i<L;i++) {
		printf("%c",abc[i]);
        Sleep(300);
    }

69,373

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧