C转换成C++的求助

来源:百度知道 编辑:UC知道 时间:2024/07/02 08:57:55
#include<stdio.h>
#include<conio.h>
#include "graphics.h"

void help_inf()
{
printf("cm_pof.exe usage: \n");
printf(" cm_pof.exe 1/0 -----\n");
printf(" Example:cm_pof.exe 1 -- show pass\n" );
printf(" Example:cm_pof.exe 0 -- show fail\n");
}

void main(int argc,char *argv[])
{

int gdriver,gmode;

gdriver=DETECT;
initgraph (&gdriver,&gmode,"");

if (argc==2)
{

if(strcmp("0",argv[1])==0)
{

textattr(128+1+(1<<4));
window(1,1,80,16);
clrscr();
setviewport(10,2,70,13,1);
setcolor(GREEN);
setbkcolor(BLACK);
settextstyle(

应该改为:
#include<stdio>
#include<conio>
#include "graphics.h"
using namespace std;

void help_inf()
{
printf("cm_pof.exe usage: \n");
printf(" cm_pof.exe 1/0 -----\n");
printf(" Example:cm_pof.exe 1 -- show pass\n" );
printf(" Example:cm_pof.exe 0 -- show fail\n");
}

void main(int argc,char *argv[])
{

int gdriver,gmode;

gdriver=DETECT;
initgraph (&gdriver,&gmode,"");

if (argc==2)
{

if(strcmp("0",argv[1])==0)
{

textattr(128+1+(1<<4));
window(1,1,80,16);
clrscr();
setviewport(10,2,70,13,1);
setcolor(GREEN);
setbkcolor(BLACK);
settextstyle(0,0,20);
outtextxy(10,40,"PASS");
}
else if(strcmp("1",argv[1])==0)
{
textattr(128+4+(4<<4)); <