| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 543 人关注过本帖
标题:这两个C程序怎么连起来啊?
只看楼主 加入收藏
hzz063
Rank: 3Rank: 3
来 自:横县百合
等 级:论坛游侠
帖 子:80
专家分:114
注 册:2010-1-27
结帖率:100%
收藏
已结贴  问题点数:10 回复次数:3 
这两个C程序怎么连起来啊?
#include <windows.h>
#include <winnt.h>
#include <stdio.h>

int main()
{
    HANDLE chwnd;
    int a;
    chwnd = GetStdHandle(STD_OUTPUT_HANDLE); //获取控制台句柄
     SetConsoleOutputCP(936); //设为中文控制台页
    for(a=1;a<128;a*=2)
    {
        SetConsoleTextAttribute(chwnd,a|FOREGROUND_INTENSITY); //设置颜色
        printf("中文Foreground Color\r\n");
    }
    return 0;
}
-------------------------------------------------------
和下面这个:


#include "stdio.h"
#include "graphics.h"


int main()
{int driver,mode,i,j ;
 
char c[]="Foreground Color";
driver=DETECT;
mode=0;
initgraph(&driver,&mode,"");
for(;;)/*直到按键结束*/
{for(i=1;i<=16;i++)/*十六种颜色变换,可以根椐自己想要那几种换也行*/
{setcolor(i);
moveto(100,200);
settextstyle(0,0,3);
outtext(c);
for(j=1;j<=10000;j++)/*推迟*/
delay(10);
}
if(bioskey(1))
break;
}
restorecrtmode();/*关闭*/
}
------------------------------------------------
我想让一个程序有上面两种功能,我把这两个放一起就出错,我不会连。请大家帮忙,谢了
搜索更多相关主题的帖子: include return 控制台 中文 
2010-01-28 10:02
Devon_Ye
Rank: 4
来 自:广东
等 级:业余侠客
帖 子:124
专家分:282
注 册:2010-1-7
收藏
得分:0 
把一个写成子函数吧
2010-01-28 11:16
hzz063
Rank: 3Rank: 3
来 自:横县百合
等 级:论坛游侠
帖 子:80
专家分:114
注 册:2010-1-27
收藏
得分:0 
#include <windows.h>
#include <winnt.h>
#include <stdio.h>
#include "graphics.h"
int main()
{
    HANDLE chwnd;
    int a;
    int driver,mode,i,j ;
  
   
    chwnd = GetStdHandle(STD_OUTPUT_HANDLE); //获取控制台句柄
     SetConsoleOutputCP(936); //设为中文控制台页
    for(a=1;a<128;a*=2)
    {
        SetConsoleTextAttribute(chwnd,a|FOREGROUND_INTENSITY); //设置颜色
        printf("中文Foreground Color\r\n");
    }
   
    char c[]="Foreground Color";
    driver=DETECT;
     mode=0;
   initgraph(&driver,&mode,"");
   for(;;)/*直到按键结束*/
   {for(i=1;i<=16;i++)/*十六种颜色变换,可以根椐自己想要那几种换也行*/
   {setcolor(i);
   moveto(100,200);
   settextstyle(0,0,3);
   outtext(c);
   for(j=1;j<=10000;j++)/*推迟*/
   delay(10);
   }
   if(bioskey(1))
   break;
   }
   restorecrtmode();/*关闭*/
}
我写成这样还是不行,请问错在那了?

一切只因为喜欢。
2010-01-28 11:35
doubleflygo
Rank: 2
等 级:论坛游民
帖 子:26
专家分:50
注 册:2010-1-22
收藏
得分:10 
第二个应该是图形学的相关内容吧,我只记得图形学的程序只能在TC下运行;
2010-01-31 14:29
快速回复:这两个C程序怎么连起来啊?
数据加载中...
 
   



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

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