为什么下面的代码会出现以下问题,我用的是VC++6.0
#include<stdio.h>#include<conio.h>voidmain(void){inti,j,x,y;clrscr();printf("\n\n***乘...
#include <stdio.h>
#include <conio.h>
void main(void)
{
int i,j,x,y;
clrscr();
printf("\n\n * * * 乘法口诀表 * * * \n\n");
x=9;
y=5;
for(i=1;i<=9;i++)
{
gotoxy(x,y);
printf("%2d ",i);
x+=3;
}
x=7;
y=6;
for(i=1;i<=9;i++)
{
gotoxy(x,y);
printf("%2d ",i);
y++;
}
x=9;
y= 6;
for(i=1;i<=9;i++)
{
for(j=1;j<=9;j++)
{
gotoxy(x,y);
printf("%2d ",i*j);
y++;
}
y-=9;
x+=3;
}
printf("\n\n");
}
9.obj :error LNK2001: unresolved external symbol _gotoxy
9.obj : error LNK2001: unresolved external symbol _clrscr
Debug/9.exe : fatal error LNK1120: 2 unresolved externals 展开
#include <conio.h>
void main(void)
{
int i,j,x,y;
clrscr();
printf("\n\n * * * 乘法口诀表 * * * \n\n");
x=9;
y=5;
for(i=1;i<=9;i++)
{
gotoxy(x,y);
printf("%2d ",i);
x+=3;
}
x=7;
y=6;
for(i=1;i<=9;i++)
{
gotoxy(x,y);
printf("%2d ",i);
y++;
}
x=9;
y= 6;
for(i=1;i<=9;i++)
{
for(j=1;j<=9;j++)
{
gotoxy(x,y);
printf("%2d ",i*j);
y++;
}
y-=9;
x+=3;
}
printf("\n\n");
}
9.obj :error LNK2001: unresolved external symbol _gotoxy
9.obj : error LNK2001: unresolved external symbol _clrscr
Debug/9.exe : fatal error LNK1120: 2 unresolved externals 展开
2个回答
展开全部
gotoxy和clrscr仅在TC及BC下可以使用。在VC里没有。
更多追问追答
追问
那怎么改这个程序呢
追答
#include
void main(void)
{
int i=1,j=1,k=0;
printf(" ****乘法口诀**** \n");
for(i;i<10;i++)
for(j;j<10;j++)
{
for(k=1;k<=j;k++)
{printf("%d*%d=%d ",k,j,k*j);}
printf("\n");
}
}
展开全部
没找到 gotoxy()和clrscr()这两个函数
更多追问追答
追问
那该怎么办啊
追答
你是想输出一个九九乘法表还是要一定要用gotoxy()和clrscr()这两个函数
来输出? 你参考下
#include <stdio.h>
#include <windows.h>
void clrscr(HANDLE hConsole)
{
COORD coordScreen = {0, 0};
BOOL bSuccess;
DWORD cCharsWritten;
CONSOLE_SCREEN_BUFFER_INFO csbi;
DWORD dwConSize;
bSuccess = GetConsoleScreenBufferInfo(hConsole, &csbi);
dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
bSuccess = FillConsoleOutputCharacter(hConsole, (TCHAR) ' ', dwConSize, coordScreen, &cCharsWritten);
bSuccess = GetConsoleScreenBufferInfo(hConsole, &csbi);
bSuccess = FillConsoleOutputAttribute(hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten);
bSuccess = SetConsoleCursorPosition(hConsole, coordScreen);
}
void gotoxy(HANDLE hOut, int x, int y)
{
COORD pos;
pos.X = x;
pos.Y = y;
SetConsoleCursorPosition(hOut, pos);
}
void main(void)
{
int i,j,x,y;
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
clrscr(hOut);
printf("\n\n * * * 乘法口诀表 * * * \n\n");
.
.
.
.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询