By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,795 Members | 1,832 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,795 IT Pros & Developers. It's quick & easy.

simple ? repost

P: n/a
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)
Jul 19 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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

Jul 19 '05 #2

P: n/a
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 :)
Jul 19 '05 #3

P: n/a

"Mike Lundell" <workingmike_no@spam_hotmail.com> wrote in message
news:vi************@corp.supernews.com...
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
Jul 19 '05 #4

P: n/a
John Harrison wrote:
"Mike Lundell" <workingmike_no@spam_hotmail.com> wrote in message
news:vi************@corp.supernews.com...
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

Jul 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.