 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Boris Glawe Guest
|
Posted: Wed Jul 30, 2003 10:43 am Post subject: Re: simple ? repost |
|
|
Mike Lundell wrote:
| Quote: | lemee try this again, for today's date ...
.............
what's wrong with this, and .. can you not declare "char" variables?
#include
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
|
|
| Back to top |
|
 |
Mike Lundell Guest
|
Posted: Wed Jul 30, 2003 10:46 am Post subject: simple ? repost |
|
|
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)
|
|
| Back to top |
|
 |
Mike Lundell Guest
|
Posted: Wed Jul 30, 2003 11:30 am Post subject: Re: simple ? repost |
|
|
| Quote: | 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 :)
|
|
| Back to top |
|
 |
John Harrison Guest
|
Posted: Wed Jul 30, 2003 11:45 am Post subject: Re: simple ? repost |
|
|
"Mike Lundell" <workingmike_no (AT) spam_hotmail (DOT) com> wrote
| Quote: | 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
int main()
{
char a = '*';
std::cout << a;
}
However char variables hold a single char, I'm guessing you want a string.
#include
#include <string>
int main()
{
std::string a = "* * * * *n";
std::cout << a;
}
john
|
|
| Back to top |
|
 |
Thomas Matthews Guest
|
Posted: Wed Jul 30, 2003 1:03 pm Post subject: Re: simple ? repost |
|
|
John Harrison wrote:
| Quote: | "Mike Lundell" <workingmike_no (AT) spam_hotmail (DOT) com> wrote in message
news:vif80dahf3331b (AT) corp (DOT) 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
int main()
{
char a = '*';
std::cout << a;
}
However char variables hold a single char, I'm guessing you want a string.
#include
#include
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
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
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|