作者polom (Polom)
看板C_and_CPP
标题[问题] 比大小比不出来
时间Tue Sep 8 08:05:08 2009
各位前辈,我的程式写到这样,可是却run不出来,不知问题该如何解决
#include "stdafx.h"
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
void arr_name(int max, int min)
{
for (int i=0; i < 11; i++)
{
int *M_max, *M_min;
if ( i < (i+1))
{
*M_max = max[i];
cout << *M_max << endl;
}else if( i < (i+1))
{
*M_min = min[i];
cout << *M_min << endl;
}
}
}
int main()
{
int name[10] = {213, 424, 56, 16, 54, 612, 46, 5, 475, 151};
int a, b;
cout << arr_name(a, b);
system("pause");
return 0;
}
--
我把记忆留在这虚构的世界,或许未来的某一天
乘着不名飞行物体回来看这过去的一点一滴
http://www.ostyle.url.tw
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 124.218.4.154
1F:→ ilway25:指标不是这样用 09/08 08:21
2F:→ polom:那我该怎麽用呢? 09/08 09:14
3F:→ VictorTom:小弟我就明说吧, 您还是把阵列, 指标, 函数的用法重新再 09/08 09:59
4F:→ VictorTom:study一下吧. name根本没有传入函数, 也不是global变数, 09/08 10:00
5F:→ VictorTom:你的函数里是拿什麽在找大小?? 如果目标a,b是max/min, 09/08 10:01
6F:→ VictorTom:那个指标只有传入arr_name()里记录max/min时用就够了, 09/08 10:01
7F:→ VictorTom:甚至既然是C++, 传参考也可以. 题外话, 程式run不出来意 09/08 10:02
8F:→ VictorTom:思太笼统, 是结果不对??没结果??有run time error??还是 09/08 10:03
9F:→ VictorTom:根本连compile就不会过?? 以你这个code应该是连compile 09/08 10:03
10F:→ VictorTom:都不会过吧我猜@_@" 总之有贴code很好, 但是问题应该描 09/08 10:04
11F:→ VictorTom:述详细一点. 最後还是一开始说的, 基础再study一下吧:) 09/08 10:05
12F:→ visor:请先详读教科书 指标 阵列 函数的用法 ........... 09/08 10:12
13F:→ polom:感谢前辈,找到问题点了 09/08 12:09