Turbo C ++无法完成嵌套循环 [英] Turbo C++ can't complete nested looping

查看:76
本文介绍了Turbo C ++无法完成嵌套循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试做这样的嵌套循环


for(i = 0; i< = 640; i ++)

{

for(j = 0; j< = 640; j ++)

{

if(getpixel(j,i)!= 0){

printf(这是一个彩色像素);

}

}

}


但c不能完成此循环并停止在进程中间为什么?

内存限制可能?


任何帮助解决?

解决方案


i尝试做这样的嵌套循环


for(i = 0; i< = 640; i ++)

{

for(j = 0; j< = 640; j ++)

{

if(getpixel(j, i)!= 0){

printf(这是一个彩色像素);

}

}

}


但c不能完成此循环并停止在进程中间为什么?

内存限制可能?


有什么帮助可以解决?



C图形分辨率为640 x 480,因此您无法在640,640处搜索像素

Savage



C图形分辨率为640 x 480,因此您无法在640,640处搜索像素



这不是问题

即使我尝试,例如; (500,500)问题仍然存在

似乎我的borland turbo c 4.5无法处理多次迭代

如果我循环通过500 * 500像素,其等于625000次迭代

我的程序只是在中间逃脱而没有竞争循环


但是如果尝试减少迭代,例如(250 * 125)它可以成功完成


任何建议?


它可以处理320x320吗?


如果可以的话可以使用类似的东西:

展开 | 选择 | Wrap | 行号

i try to do nested looping like this

for (i=0;i<=640;i++)
{
for(j=0;j<=640;j++)
{
if(getpixel(j,i)!=0) {
printf("this a color pixel);
}
}
}

but c can''t complete this loop and stop in the middle of process why?
memory limitation maybe?

any help to solve?

解决方案

i try to do nested looping like this

for (i=0;i<=640;i++)
{
for(j=0;j<=640;j++)
{
if(getpixel(j,i)!=0) {
printf("this a color pixel);
}
}
}

but c can''t complete this loop and stop in the middle of process why?
memory limitation maybe?

any help to solve?

The C graphics resolution is 640 x 480 so you cannot search for pixel at 640,640

Savage


The C graphics resolution is 640 x 480 so you cannot search for pixel at 640,640

Savage


that was not the problem
even i try, eg; (500,500) the problem was still occur
it seems that my borland turbo c 4.5 can''t handle to many iteration
if i looping through 500*500 pixel, its equal to 625000 iteration
and my program just escape at the middle without compelete that loop

but if try to decrease the iteration eg(250*125) it can complete succesfully

any suggestion?


Can it handle 320x320?

If it can u can use something like:

Expand|Select|Wrap|Line Numbers


这篇关于Turbo C ++无法完成嵌套循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆