Can someone tell my why this is...

This is a discussion on Can someone tell my why this is... within the C++ Programming forums, part of the General Programming Boards category; 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; ...

  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,831
    >>> 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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21