做文字游戏急求大家

pprin2008 2009-05-05 08:04:39
#include<iostream>
#include<stdio.h>
#include<string>
#include<windows.h>
using namespace std;
void main()
{
char *str1=" 你是白痴 ";
for(int i=0;i<strlen(str);i+=2)
{

cout<<*(str+i)<<*(str+i+1);
cout<<" ";
system("color 3");
Sleep(100);

}

system("cls");
Sleep(500);
cout<<'\t'<<'\t';
for(int j=0;j<10;j++)
{
Sleep(400);
system("cls");
for(int i=0;i<j+1;i++)
cout<<endl;
cout<<'\t'<<'\t';
cout<<str1;
system("color 6");
}
我想把它弄成一个函数,然后用这个函数调用文本文档.我一时想不出来,有谁能够帮我想出啊.我要调用一个文档,然后实现"你是白痴"四个字从上到中间的效果













}
...全文
84 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
lzh9955 2009-05-05
  • 打赏
  • 举报
回复
UP
pprin2008 2009-05-05
  • 打赏
  • 举报
回复
我想把它整个弄到一个成员函数里面,然后在调用怎么弄呢?
Paradin 2009-05-05
  • 打赏
  • 举报
回复

#include <iostream>
#include <stdio.h>
#include <string>
#include <windows.h>
#include <fstream>
#include <sstream>
using namespace std;

void show(const char* str)
{
for(int i=0;i <strlen(str);i+=2)
{

cout <<*(str+i) <<*(str+i+1);
cout <<" ";
system("color 3");
Sleep(100);

}

system("cls");
Sleep(500);
cout <<'\t' <<'\t';
for(int j=0;j <10;j++)
{
Sleep(400);
system("cls");
for(int i=0;i <j+1;i++)
cout <<endl;
cout <<'\t' <<'\t';
cout <<str;
system("color 6");
}
}

void main()
{
ifstream fileIn("input.txt");
ostringstream ss;
ss << fileIn.rdbuf();
fileIn.close();
show(ss.str().c_str());
}


liliangbao 2009-05-05
  • 打赏
  • 举报
回复
up

65,211

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

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