473,387 Members | 1,465 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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)
Jul 19 '05 #1
4 2244
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
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

"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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Chuck Anderson | last post by:
I've read some discussions, searched Google, tried pack, unpack, bin2hex, explode, implode, and I just can't figure out how to convert this data. I am trying to read a file with the following...
1
by: barnesc | last post by:
Hi! Here's a simple hashcash implementation in Python. 28 lines of actual code. Can be reduced to 17 lines for instructional purposes, if you don't want clustering, and use xrange() instead...
10
by: JustSomeGuy | last post by:
I have a few classes... class a : std::list<baseclass> { int keya; }; class b : std::list<a> { int keyb;
13
by: na1paj | last post by:
here's a simple linked list program. the DeleteNode function is producing an infinit loop i think, but i can't figure out where.. #include <stdio.h> typedef struct { char *str; //str is a...
3
by: Adam | last post by:
I've posted about this previously, but failed to receive a satisfactory response, so have included a code sample: I am trying to receive messages from an HTML viewer control in compact.net (c#),...
14
by: Steve McLellan | last post by:
Hi, Sorry to repost, but this is becoming aggravating, and causing me a lot of wasted time. I've got a reasonably large mixed C++ project, and after a number of builds (but not a constant...
5
by: Adrian Parker | last post by:
I've got the standard SqlCacheDependency working just fine , ie. I've defined (and encrypted) the connectionStrings section in the web.config, and I've also defined an an sqlCacheDependency in the...
2
by: Gerry | last post by:
I have a combo box and I can populate it with my class of dat (the class allows me to store each userid,username called - see code below I want the user to select the dropdown and see the...
2
by: Raj | last post by:
Hi, I have the following problem. I am displaying and printing a PDF file that is generated by my Application server. The print dialogs comes up correctly for the small PDF for the larger PDFs...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.