下载
加入VIP
  • 专属下载特权
  • 现金文档折扣购买
  • VIP免费专区
  • 千万文档免费下载

上传资料

关闭

关闭

关闭

封号提示

内容

首页 VC++6

VC++6.0编程步骤

VC++6

蔡至道
2017-09-19 0人阅读 举报 0 0 暂无简介

简介:本文档为《VC++6doc》,可适用于综合领域

CC上机操作步骤及一些代码(以VC为例)现在应该有好多同学在学C语言或者是C语言学期开头可能你还摸不着头绪现在我就写一下简单的上机操作在附带上一些简单的代码:以VC为操作例子当然电脑上要有VC如果没有我可以免费提供。首先打开VC:会显示出这样一个界面(首先声明我用的是绿色中文版的版的VC)点击“关闭”关闭以后就是主界面了点击“文件”“新建”会出现这样的界面:点击“工程“里面的“WinConsoleApplication”右面的“工程名称”填上你建工程的名称例如“”“位置”可以选择默认的也可以点击后面的“…”选择你想存储的位置然后点击确定。如图:确定后会出现这样的界面:点击“完成”出现这样的画面:再点击“文件”“新建”“文件”“CSourcefile”,在右边“文件名”上填上名字例如“”如图:点击确定出现界面:这样就可以在蓝色框里写程序了例如这样一个程序:写好就可以运行一下试试点击“编译”如果写的程序没有错误就会在下面出现这样的解释:然后“组建”“运行”就会出现这样一个DOS界面输出运行结果:这样就完了呵呵。解释一下吧#include<iostream>是包含一个输入输出的头文件必须有的Usingnamespacestd是标准命名空间C独有的C应该就不用了C的程序也完全可以在这里面写C是完全兼容C的Intmain()是必须有的且必须是一个Return是一个返回值一般要有的但是Voidmain()是不需要的好吧再弄一个五子棋游戏的代码吧#include<graphicsh>#include<conioh>#include<stdlibh>#include<stdioh>#include<timeh>intmark={,,,,,,,,,}intf,score,a={{,},{,},{,},{,},{,},{,},{,},{,}}structposition坐标结构体{intxinty}positioncalculate()计算落子的价值并获得最有落子价值坐标{positionpinti,jfor(i=i<i){for(j=j<j){scoreij=}}for(i=i<i){for(j=j<j){if(fij!=)continueelse{(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=mark(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==)scoreij=markif(fij==fij==fij==)scoreij=markif(fij==fij==fij==)scoreij=markif(fij==fij==fij==)scoreij=markif(fij==fij==fij==)scoreij=markif(fij==fij==fij==)scoreij=markif(fij==fij==fij==)scoreij=markif(fij==fij==fij==)scoreij=markif(fij==fij==fij==)scoreij=markif(fij==fij==fij==)scoreij=markif(fij==fij==fij==)scoreij=markif(fij==fij==fij==)scoreij=markif(fij==fij==fij==)scoreij=markif(fij==fij==fij==)scoreij=markif(fij==fij==fij==)scoreij=markif(fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=mark(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=mark(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==fij==fij==fij==fij==)scoreij=markif(fij==)scoreij=markif(fij==)scoreij=markif(fij==)scoreij=markif(fij==)scoreij=markif(fij==)scoreij=markif(fij==)scoreij=markif(fij==)scoreij=markif(fij==)scoreij=markif(fij==)scoreij=markif(fij==)scoreij=markif(fij==)scoreij=markif(fij==)scoreij=markif(fij==)scoreij=markif(fij==)scoreij=markif(fij==)scoreij=markif(fij==)scoreij=mark}}}px=,py=for(i=i<i){for(j=j<j){if(score<scoreij){score=scoreijpx=i,py=j}}}returnp}intchoose()选择函数{charninty=setbkmode(TRANSPARENT)setfont(,,"楷体")setcolor(RED)outtextxy(,,"五"),outtextxy(,,"子"),outtextxy(,,"棋")setcolor(BLUE)setfont(,,"楷体")outtextxy(,,"人人对战!")outtextxy(,,"人机对战!")setcolor(BROWN)setfont(,,"楷体")outtextxy(,,"按ws建进行选择!")outtextxy(,,"按空格将确认选择!")setcolor(YELLOW)setfillstyle(YELLOW)fillcircle(,y,)while(){n=getch()if(n=='w'||n=='s'){setcolor()setfillstyle()fillcircle(,y,)y=ysetcolor(YELLOW)setfillstyle(YELLOW)fillcircle(,y,)}if(n==''){if(getpixel(,)!=)returnelseif(getpixel(,)!=)return}}}voidstart()赋棋盘初值{for(inti=i<i)for(intj=j<j)fij=}intdraw()棋盘{initgraph(,)intk=k=choose()setbkcolor(LIGHTGRAY)cleardevice()setbkmode(TRANSPARENT)setfont(,,"楷体")setcolor(RED)outtextxy(,,"五")outtextxy(,,"子")outtextxy(,,"棋")setcolor()setlinestyle(PSSOLID,,)intx=,y=intifor(i=i<i){line(x,,x,)x=xif(i<){line(,y,,y)y=y}}returnk}voidchange(intm){setfont(,,"楷体")if(m==){setcolor(BLUE)outtextxy(,,"棋手落子")}elseif(m==){setcolor(BLUE)outtextxy(,,"电脑落子")}}voidclearchange(intm){m=msetfont(,,"楷体")if(m==){setcolor(LIGHTGRAY)outtextxy(,,"棋手落子")}elseif(m==){setcolor(LIGHTGRAY)outtextxy(,,"电脑落子")}}voidchange(intm){setfont(,,"楷体")if(m==){setcolor(BLUE)outtextxy(,,"号棋手落子")}elseif(m==){setcolor(BLUE)outtextxy(,,"号棋手落子")}}voidclearchange(intm){m=msetfont(,,"楷体")if(m==){setcolor(LIGHTGRAY)outtextxy(,,"号棋手落子")}elseif(m==){setcolor(LIGHTGRAY)outtextxy(,,"号棋手落子")}}voidblack(intm,intn)黑子{setfillstyle(DARKGRAY)setcolor(DARKGRAY)circle(m,n,)floodfill(m,n,DARKGRAY)}voidwhite(intm,intn)白子{setfillstyle(WHITE)setcolor(WHITE)circle(m,n,)floodfill(m,n,WHITE)}intwhitejudge(intn,intm)判断白子胜{inti,j,n,nwhile(){n=n=for(i=n,j=mj>=j){if(fij==)nelsebreak}for(i=n,j=mj<j){if(fij==)nelsebreak}if(nn>=){returnbreak}n=n=for(i=n,j=mi>i){if(fij==)nelsebreak}for(i=n,j=mi<i){if(fij==)nelsebreak}if(nn>=){returnbreak}n=n=for(i=n,j=mi>=,j>=i,j){if(fij==)nelsebreak}for(i=n,j=mi<,j<i,j){if(fij==)nelsebreak}if(nn>=){returnbreak}n=n=for(i=n,j=mi>=,j<i,j){if(fij==)nelsebreak}for(i=n,j=mi<,j>i,j){if(fij==)nelsebreak}if(nn>=){returnbreak}returnbreak}}intblackjudge(intn,intm)判断黑子胜{inti,j,n,nwhile(){n=n=for(i=n,j=mj>=j){if(fij==)nelsebreak}for(i=n,j=mj<j){if(fij==)nelsebreak}if(nn>=){returnbreak}n=n=for(i=n,j=mi>i){if(fij==)nelsebreak}for(i=n,j=mi<i){if(fij==)nelsebreak}if(nn>=){returnbreak}n=n=for(i=n,j=mi>=,j>=i,j){if(fij==)nelsebreak}for(i=n,j=mi<,j<i,j){if(fij==)nelsebreak}if(nn>=){returnbreak}n=n=for(i=n,j=mi>=,j<i,j){if(fij==)nelsebreak}for(i=n,j=mi<,j>i,j){if(fij==)nelsebreak}if(nn>=){returnbreak}returnbreak}}voidmain()主函数{B:start()intl=draw()intt=,m,n,e=,rif(l==)change(t)elseif(l==)change(t)positionpsrand((unsigned)time())MOUSEMSGkFlushMouseMsgBuffer()while(l==){change(t)k=GetMouseMsg()if(kuMsg==WMLBUTTONDOWN){if(kx>=)continuem=(int)kx,n=(int)ky}elsecontinueif(t==fnm==)棋手落子{fnm=black(m*,n*)if(blackjudge(n,m)){setcolor(MAGENTA)outtextxy(,,"棋手获胜")setfont(,,"楷体")setcolor(BLUE)outtextxy(,,"按y重新开始!")outtextxy(,,"按其他键结束!")chard=getch()if(d=='y'||d=='Y'){setbkcolor()cleardevice()closegraph()gotoB}elsegotoA}t=tclearchange(t)}change(t)r=rand()if(e>)p=calculate()elsepx=nar,py=mareif(t==)电脑落子{white(py*,px*)fpxpy=if(whitejudge(px,py)){setcolor(MAGENTA)outtextxy(,,"电脑获胜")setfont(,,"楷体")setcolor(BLUE)outtextxy(,,"按y重新开始!")outtextxy(,,"按其他键结束!")chard=getch()if(d=='y'||d=='Y'){setbkcolor()cleardevice()closegraph()gotoB}elsegotoA}t=tclearchange(t)}}while(l==){k=GetMouseMsg()if(kuMsg==WMLBUTTONDOWN){if(kx>=)continuem=(int)kx,n=(int)ky}elsecontinuechange(t)if(t==kuMsg==WMLBUTTONDOWNfnm==)号棋手落子{fnm=black(m*,n*)if(blackjudge(n,m)){setcolor(MAGENTA)outtextxy(,,"号棋手获胜")setcolor(BLUE)outtextxy(,,"按y重新开始!")outtextxy(,,"按其他键结束!")chard=getch()if(d=='y'||d=='Y'){setbkcolor()cleardevice()closegraph()gotoB}elsegotoA}t=tclearchange(t)}change(t)D:if(t==fnm==)号棋手落子{if(kuMsg==WMLBUTTONDOWN){if(kx>=)gotoDm=(int)kx,n=(int)ky}elsegotoDfnm=white(m*,n*)if(whitejudge(n,m)){setcolor(MAGENTA)outtextxy(,,"号棋手获胜")setcolor(BLUE)outtextxy(,,"按y重新开始!")outtextxy(,,"按其他键结束!")chard=getch()if(d=='y'||d=='Y'){setbkcolor()cleardevice()closegraph()gotoB}elsegotoA}t=tclearchange(t)}}A:closegraph()}

用户评价(0)

关闭

新课改视野下建构高中语文教学实验成果报告(32KB)

抱歉,积分不足下载失败,请稍后再试!

提示

试读已结束,如需要继续阅读或者下载,敬请购买!

文档小程序码

使用微信“扫一扫”扫码寻找文档

1

打开微信

2

扫描小程序码

3

发布寻找信息

4

等待寻找结果

我知道了
评分:

/28

VC++6

VIP

在线
客服

免费
邮箱

爱问共享资料服务号

扫描关注领取更多福利