[求助]求助 b=++a + ++a + ++a 得算法过程
求助 b=++a + ++a + ++a 得算法过程 a=3那位高手教教我 我用的是Vc6.0
怎么有编译错误
#include <iostream.h>
int main(void){
int a=3,b;
b=++a+++a+++a;
cout<<a<<endl<<b<<endl;
return 0;
}
--------------------Configuration: Institution - Win32 Debug--------------------
Compiling...
R&D.CPP
D:\创世纪\MICHEAL\MyProjects\AAA Institution\R&D.CPP(4) : error C2105: '++' needs l-value
执行 cl.exe 时出错.
R&D.OBJ - 1 error(s), 0 warning(s)
#include <stdio.h>
int main()
{
int a=3,b;
b=++a + ++a + ++a;
printf(\"%d\n\",b);
}
.file \"temp.c\"
.def ___main; .scl 2; .type 32; .endef
.text
LC0:
.ascii \"%d\12\0\"
.globl _main
.def _main; .scl 2; .type 32; .endef
_main:
pushl %ebp
movl %esp, %ebp
subl $24, %esp
andl $-16, %esp
movl $0, %eax
movl %eax, -12(%ebp)
movl -12(%ebp), %eax
call __alloca
call ___main
movl $3, -4(%ebp)
leal -4(%ebp), %eax
incl (%eax)
leal -4(%ebp), %eax
incl (%eax)
movl -4(%ebp), %eax
movl -4(%ebp), %edx
addl %eax, %edx
leal -4(%ebp), %eax
incl (%eax)
movl %edx, %eax
addl -4(%ebp), %eax
movl %eax, -8(%ebp)
movl -8(%ebp), %eax
movl %eax, 4(%esp)
movl $LC0, (%esp)
call _printf
leave
ret
.def _printf; .scl 2; .type 32; .endef