如何返回上一行!或者返回初始坐标!

clhposs 2008-08-20 03:23:57
我这个是99乘法表!我故意逆转思维!竖着输出!但是需要返回上一行!
不然不美观!飞雪MM有法吗?
#include<stdio.h>
#include<conio.h>

void code(int number);
int main()
{
int x,y,pass;
for(x=1;x<10;++x)
{
for(pass=1;pass<x;++pass)
printf("\n");
for(y=x;y<10;++y)
{
code(x);
printf("%d*%d=%d\n",y,x,x*y);
}
}
getch();
return 0;
}

void code(int number)
{
--number;
while(number)
printf("\t",--number);
}
...全文
296 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
lin_style 2008-08-20
  • 打赏
  • 举报
回复
看不到回复。
lin_style 2008-08-20
  • 打赏
  • 举报
回复
汗。
我查阅的资料SetConsoleCursorPosition怎么是TC/BC中的。。
明明VC也可以的嘛
  • 打赏
  • 举报
回复
顶你一下,轻轻的!实现VC下取代TC下的GOTOXY函数!
#include <windows.h>
#include<stdio.h>

void gotoxy(int x, int y) {
COORD c;
c.X = x - 1;
c.Y = y - 1;
SetConsoleCursorPosition (GetStdHandle(STD_OUTPUT_HANDLE), c);
}

int main()
{
int x,y;

for(x=1;x<10;++x)
{

for(y=x;y<10;++y)
{
gotoxy(8*(x-1),y);
printf("%d*%d=%d\n",y,x,x*y);
}
}
return 0;
}
clhposs 2008-08-20
  • 打赏
  • 举报
回复
我就是想要在VC中能运行的
在TC中已有方法
见代码
#include<stdio.h>
#include<conio.h>
int main()
{
int x,y,pass;

for(x=1;x<10;++x)
{

for(y=x;y<10;++y)
{
gotoxy(8*(x-1),y);
printf("%d*%d=%d\n",y,x,x*y);
}
}
getch();
return 0;
}
lin_style 2008-08-20
  • 打赏
  • 举报
回复
BOOL SetConsoleCursorPosition(
HANDLE hConsoleOutput, // handle to console screen buffer
COORD dwCursorPosition // new cursor position coordinates
);

这个算不,TC/BC中。。
clhposs 2008-08-20
  • 打赏
  • 举报
回复
玩个性 -_-! 玩另类!

有方法不!哎!
lin_style 2008-08-20
  • 打赏
  • 举报
回复
LZ想玩语法还是想玩GUI
太乙 2008-08-20
  • 打赏
  • 举报
回复
嵌入汇编~

我用过汇编定位,还不知道c语言里怎么定位@!

不过linux/unix下可以通过包含curses.h,通过move函数来实现!
  • 打赏
  • 举报
回复
飞雪MM??????
飞雪肯定不乐意了!~o(∩_∩)o...哈哈!~
他老人家闭关了,不怎么上网。

69,369

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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