Re: A83: OT:C++ program


[Prev][Next][Index][Thread]

Re: A83: OT:C++ program




ManjiLump@aol.com wrote:
> 
> What's wrong with this code, every time I run the prgm it displays 1
> constantly. When it should display each of the values (1-10) held by the var
> cnt. Can someone please help me out, so I don't have to constantly restart my
> computer everytime it loops 1 and freezes up.
> Michael
> 
> #include<iostream.h>
> #include<stdio.h>
> #include<ctype.h>
> #include<conio.h>
> void main()
>         {
>         clrscr();
>         for(int cnt=1;cnt<=10;cnt=cnt++)
>         cout<<cnt<<endl;
>         }

<zscientist@collegemail.com>

in the for loop, here is how it should go:

for(int cnt=1;cnt<=10;cnt++)

the ++ is increment so you do not need
the cnt=.

Wrong way:  cnt=cnt++
RIGHT way: cnt++

Hope this helps!

<zscientist@collegemail.com>
<http://zscientist.home.ml.org>
The OS that kicks ass : U N I X
Micro$haft Winblows 98 is crap!!
(MS-Windows that bloated OS is copyright by Micro$oft Corp.)

(Note : This is the TI83 ASM mailing list)
<EOF>


References: