Mephis 发表于 2003-2-12 17:38

Cpp1.exe - 9 error(s), 3 warning(s)

--------------------Configuration: Cpp1 - Win32 Debug--------------------
Compiling...
Cpp1.cpp
d:\meine eigene dateien\temp\1\cpp1.cpp(8) : error C2065: 'cin' : undeclared identifier
d:\meine eigene dateien\temp\1\cpp1.cpp(8) : warning C4552: '>>' : operator has no effect; expected operator with side-effect
d:\meine eigene dateien\temp\1\cpp1.cpp(30) : error C2065: 'cout' : undeclared identifier
d:\meine eigene dateien\temp\1\cpp1.cpp(30) : error C2297: '<<' : illegal, right operand has type 'char '
d:\meine eigene dateien\temp\1\cpp1.cpp(31) : error C2297: '<<' : illegal, right operand has type 'char '
d:\meine eigene dateien\temp\1\cpp1.cpp(37) : error C2297: '<<' : illegal, right operand has type 'char '
d:\meine eigene dateien\temp\1\cpp1.cpp(38) : error C2297: '<<' : illegal, right operand has type 'char '
d:\meine eigene dateien\temp\1\cpp1.cpp(39) : error C2297: '<<' : illegal, right operand has type 'char '
d:\meine eigene dateien\temp\1\cpp1.cpp(39) : error C2065: 'endl' : undeclared identifier
d:\meine eigene dateien\temp\1\cpp1.cpp(42) : warning C4552: '<<' : operator has no effect; expected operator with side-effect
d:\meine eigene dateien\temp\1\cpp1.cpp(51) : error C2297: '<<' : illegal, right operand has type 'char '
d:\meine eigene dateien\temp\1\cpp1.cpp(52) : warning C4552: '<<' : operator has no effect; expected operator with side-effect
Error executing cl.exe.

Cpp1.exe - 9 error(s), 3 warning(s)

Mephis 发表于 2003-2-12 17:39

让我再看看,再想想

musicbug 发表于 2003-2-12 17:39

呵呵。。
C++

#include<iostream.h>

Mephis 发表于 2003-2-12 17:47

axo,
不好意思没注意

Mephis 发表于 2003-2-12 17:57

不过用C++我解决了,通过试验成功

#include <stdio.h>
void main ()
{
int a,i;
printf("Geben Sie 10 Zahle ein\n");
for (i=0;i<10;i++)
scanf("%d",&a);

int j,t;
int b;
b=0;
int x=0;

for (j=1;j<10;j++)
{
if (a<a)
{t=a;
a=a;
a=t;
}
}

b=a;

for (i=1;i<10-1;i++)
{
for (j=i+1;j<10;j++)
{
if (a<a)
{t=a;
a=a;
a=t;
}
}

if (b!=a)
{
        b=a;
        x+=1;
}
}
printf("die Zahle in aufsteigender Reihefolge\n");
for (i=0;i<x+1;i++)
printf("%d\n",b);
}

musicbug 发表于 2003-2-12 17:59

有错。

Geben Sie 10 Zahle ein
1
1
1
2
2
2
3
3
3
4444
die Zahle in aufsteigende
1
2
3
Press any key to continue

Mephis 发表于 2003-2-12 18:00

先把第一轮下来的最小值a给b

然后每一轮得到的a和b,如果不同则b=a;

到最后就输出b

musicbug 发表于 2003-2-12 18:03

最大的数字总是丢失了。

Mephis 发表于 2003-2-12 18:04

唉呀,这个怪问题我也就不知道了,理论上来说该对的呀

我也请教一个问题
a=1
b=(++a)+(++a)+(++a)
b=?

Mephis 发表于 2003-2-12 18:07

最大的数字总是丢失了。

因为我定义了b的原因吧

但是我定义b[]在C++中不允许
页: 1 [2] 3 4 5
查看完整版本: 很奇怪的错误,我怎么都看不出来,高手指点一把,不胜感激!!!