一点问题 ,求指导 !!

weixin_36747231 2016-12-26 10:55:19
#include "stdafx.h"
float*search(float(*p)[4])
{
int i;
float*pt;
pt=*(p+1);
for(i=0;i<4;i++)
{
if(*(*p+i)<60)
pt=*p;
}
return(pt);
}

int _tmain(int argc, _TCHAR* argv[])
{
float score[][4]={{60,75,82,91},{75,81,91,90},{51,65,78,84},{65,72,78,72}};
float*p;
int i,j;
for(i=0;i<4;i++)
{
p=search(score+i);
if(p==*(score+i))
{ printf("The student NO.%d list:",i+1);
for(j=0;j<4;j++)
printf("%5.1f",*p);
}
}
getch();


return 0;
}
+++++++++++++++++++++++++++++
error C3861: “getch”: 找不到标识符
========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========如何解决 ,求大神指点
...全文
125 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
weixin_36747231 2016-12-27
  • 打赏
  • 举报
回复
四个数字应该不一样 ,为什么完全 一样 ,还是错了、


#include "stdafx.h"
#include<conio.h>
float*search(float(*p)[4])
{
int i;
float*pt;
pt=*(p+1);
for(i=0;i<4;i++)
{
if(*(*p+i)<60)
pt=*p;
}
return(pt);
}

int _tmain(int argc, _TCHAR* argv[])
{
float score[][4]={{60,75,82,91},{75,81,91,90},{51,65,78,84},{65,72,78,72}};
float*p;
int i,j;
for(i=0;i<4;i++)
{
p=search(score+i);
if(p==*(score+i))
{ printf("The student NO.%d list:",i+1);
for(j=0;j<4;j++)
printf("%5.1f",*p);
}
}
_getch();


return 0;
}
AlbertS 2016-12-26
  • 打赏
  • 举报
回复
加上头文件conio.h
paschen 2016-12-26
  • 打赏
  • 举报
回复
#include<conio.h> 另建议使用:_getch(); 代替 getch();
小灸舞 版主 2016-12-26
  • 打赏
  • 举报
回复
加上头文件#include<conio.h>就行了

#include "stdafx.h"
#include<conio.h>
float*search(float(*p)[4])
{
	int i;
	float*pt;
	pt = *(p + 1);
	for (i = 0; i<4; i++)
	{
		if (*(*p + i)<60)
			pt = *p;
	}
	return(pt);
}

int _tmain(int argc, _TCHAR* argv[])
{
	float score[][4] = { { 60, 75, 82, 91 }, { 75, 81, 91, 90 }, { 51, 65, 78, 84 }, { 65, 72, 78, 72 } };
	float*p;
	int i, j;
	for (i = 0; i<4; i++)
	{
		p = search(score + i);
		if (p == *(score + i))
		{
			printf("The student NO.%d list:", i + 1);
			for (j = 0; j<4; j++)
				printf("%5.1f", *p);
		}
	}
	getchar();


	return 0;
}

69,373

社区成员

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

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