Thread: Can someone tell my why this is...

  1. #1
    Sinamerica
    Guest

    Can someone tell my why this is...

    Can someone tell my why this is only outputting one asterick?

    #include <iostream.h>

    int main()
    {
    for(int x=0;x<7;x++);
    {
    cout<<"*"<<endl;
    }
    return 0;
    }

    I'm trying to get it to output 8 astericks like this;
    *
    *
    *
    *
    *
    *
    *
    *

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    >>> for(int x=0;x<7;x++);

    A classic gotcha, why have you put a ";" after the for()?
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  3. #3
    SinAmerica
    Guest

    Doh!

    Hehe, newbie mistake. Thanks alot adrian.

Popular pages Recent additions subscribe to a feed
Website Security Test