simple ? repost

Discussion in 'C++' started by Boris Glawe, Jul 30, 2003.

  1. Boris Glawe

    Boris Glawe Guest

    Mike Lundell wrote:
    > lemee try this again, for today's date :)...
    >
    > .............
    >
    > what's wrong with this, and .. can you not declare "char" variables?
    >
    > #include <iostream>
    >
    > int main()
    > {
    > int a = "* * * * * * * *\n";
    > std::cout << a;
    > return EXIT_SUCCESS;
    > }
    >
    > thx
    >
    > (p.s. i reposted because the date on my comp was for yesterday, and i didn't
    > know if ppl would see the post so i changed the date and now i'm
    > reposting.. sorry if someone get's mad about that)

    Before reposting hundreds of times, you
    should have looked for answers... my
    answer arrived two minutes before your
    third repost :)

    Btw.: You can also try to cancel your
    posts if something went wrong !

    greets Boris
    Boris Glawe, Jul 30, 2003
    #1
    1. Advertising

  2. Boris Glawe

    Mike Lundell Guest

    lemee try this again, for today's date :)...

    ..............

    what's wrong with this, and .. can you not declare "char" variables?

    #include <iostream>

    int main()
    {
    int a = "* * * * * * * *\n";
    std::cout << a;
    return EXIT_SUCCESS;
    }

    thx

    (p.s. i reposted because the date on my comp was for yesterday, and i didn't
    know if ppl would see the post so i changed the date and now i'm
    reposting.. sorry if someone get's mad about that)
    Mike Lundell, Jul 30, 2003
    #2
    1. Advertising

  3. Boris Glawe

    Mike Lundell Guest


    > Before reposting hundreds of times, you
    > should have looked for answers... my


    thx lol, i just installed mndrk, and i'm new to it. including this
    newsreader. anyway.. just call me noob and go on with ur day :)
    Mike Lundell, Jul 30, 2003
    #3
  4. "Mike Lundell" <workingmike_no@spam_hotmail.com> wrote in message
    news:...
    > lemee try this again, for today's date :)...
    >
    > .............
    >
    > what's wrong with this, and .. can you not declare "char" variables?
    >
    > #include <iostream>
    >
    > int main()
    > {
    > int a = "* * * * * * * *\n";
    > std::cout << a;
    > return EXIT_SUCCESS;
    > }
    >
    > thx


    What's wrong? "* * * * ... is not an integer.

    Can you declare char variables? Of course

    #include <iostream>

    int main()
    {
    char a = '*';
    std::cout << a;
    }

    However char variables hold a single char, I'm guessing you want a string.

    #include <iostream>
    #include <string>

    int main()
    {
    std::string a = "* * * * *\n";
    std::cout << a;
    }

    john
    John Harrison, Jul 30, 2003
    #4
  5. John Harrison wrote:

    > "Mike Lundell" <workingmike_no@spam_hotmail.com> wrote in message
    > news:...
    >
    >>lemee try this again, for today's date :)...
    >>
    >>.............
    >>
    >>what's wrong with this, and .. can you not declare "char" variables?
    >>
    >>#include <iostream>
    >>
    >>int main()
    >>{
    >> int a = "* * * * * * * *\n";
    >> std::cout << a;
    >> return EXIT_SUCCESS;
    >>}
    >>
    >>thx

    >
    >
    > What's wrong? "* * * * ... is not an integer.
    >
    > Can you declare char variables? Of course
    >
    > #include <iostream>
    >
    > int main()
    > {
    > char a = '*';
    > std::cout << a;
    > }
    >
    > However char variables hold a single char, I'm guessing you want a string.
    >
    > #include <iostream>
    > #include <string>
    >
    > int main()
    > {
    > std::string a = "* * * * *\n";
    > std::cout << a;
    > }
    >
    > john
    >
    >


    The OP may also want a collection of characters terminated by a NULL,
    IOW, a C style string:
    #include <iostream>
    using std::cout;

    int main(void)
    {
    char ernie[] = "Ernie";
    const char * const fred = "Fred";
    cout << ernie << '\n'
    << fred << '\n';
    return 0;
    }

    --
    Thomas Matthews

    C++ newsgroup welcome message:
    http://www.slack.net/~shiva/welcome.txt
    C++ Faq: http://www.parashift.com/c -faq-lite
    C Faq: http://www.eskimo.com/~scs/c-faq/top.html
    alt.comp.lang.learn.c-c++ faq:
    http://www.raos.demon.uk/acllc-c /faq.html
    Other sites:
    http://www.josuttis.com -- C++ STL Library book
    Thomas Matthews, Jul 30, 2003
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bjh

    Mystery Repost

    bjh, Jan 13, 2004, in forum: Perl
    Replies:
    0
    Views:
    710
  2. Little Monster

    Newbie cgi problem - repost

    Little Monster, May 2, 2004, in forum: Perl
    Replies:
    3
    Views:
    602
    Little Monster
    May 6, 2004
  3. Sabre

    Postback problems - repost

    Sabre, Jul 13, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    394
    Sabre
    Jul 14, 2003
  4. Programatix
    Replies:
    1
    Views:
    374
    Kathleen Dollard
    Jul 17, 2003
  5. Alan Silver
    Replies:
    0
    Views:
    330
    Alan Silver
    Oct 6, 2005
Loading...

Share This Page