Re: c++ - assigning character values to variables

  • From: "Martin Slack" <m.g.slack@xxxxxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Thu, 8 Nov 2007 10:45:16 -0000

Hi Lamar,

 Characters are enclosed in single quotes, strings in double ones.

 Array subscripts are in square brackets, not parentheses.

 So your two examples would be:

char letter;
letter = 'x';

char array[3];
array[0] = 'o';


hth

Martin


----- Original Message ----- From: "Lamar Upshaw" <lupshaw@xxxxxxxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Thursday, November 08, 2007 8:44 AM
Subject: c++ - assigning character values to variables


Ok, so far I've learned that I have to declare the variable type, and then
give the variable an assignment, quite similar to javascript and perl in
some ways.

int x;
x=0;

But now when i want to give a variable an assigned character, I can't seem
to get this right:

char letter;
letter = "x";

I git a char conversion error.  The book I'm reading is covering strings,
but more along the line of keyboard imput, not when one wants to have a
character assigned to the variable within the program. Also, how ever this
is properly done, does this apply to arrays as well?

char array(3);
array(0) ="o";

Thanks for any help anyone doesn't mind offering.  I know for most of you
this is very elementary.

With All Respect,
Upshaw, LaMar T
----- Original Message ----- From: "Marlon Brandão de Sousa" <splyt.lists@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Wednesday, November 07, 2007 9:09 AM
Subject: Re: Beginning C and C++


then please check the books I pointed out but be prepared to some more
learning, as simbian developement is pretty much different from
windows or posix developement. The tutorials will teach you the
language but you probably won't be able to use much of the
developement concepts you'll be learning. Jamal packaged one tutorial
about simbian developement, which you will need to read and understand
latter, but first you need to get used and able to understand the
language.
Marlon

2007/11/7, Lamar Upshaw <lupshaw@xxxxxxxxxxxxxx>:
Thanks for this suggestion marlon.  It is indeed C++ I want to learn,
because my goal is to work with the symbian SDK's, which from what I've
been
reading up about, uses C++ as one of it's most popular languages.  I may
be
mistaken, but as far as I understand, it's the only language that actually communicates directly with the operating system without some type of third
party interpreter, and it uses symbian's *.sis packaging.

With All Respect,
Upshaw, LaMar T
----- Original Message -----
From: "Marlon Brandão de Sousa" <splyt.lists@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Tuesday, November 06, 2007 9:48 AM
Subject: Re: Beginning C and C++


> it deppends on what exactly you need to do. If you need to use C only
> then go look for a book. If you want to learn c++ ten use thinking in
> c++ v 1 and thinking in c++ v 2, by Brusse Equel, at www.mindview.net.
> If you are planning to use c++ this great tutorial will teach
> everything of C you will possibly need to know in order to better
> understand and use c++. If you however will need C then you need to
> know much more about the language than this tutorial will teach so you
> would be better to find a book.
> Marlon
>
> 2007/11/6, Lamar Upshaw <lupshaw@xxxxxxxxxxxxxx>:
> > I've done what was suggested, and downloaded and installed mingw.  It
works
> > nicely on this ancient machine! *smile* lol.  I tried the sample
programs in
> > the documentation, and everything worked well.
> > Now, can anyone suggest a starting resource for me to learn C and > > C++?
I'm
> > hoping there's a such thing as a tutorial for beginners.  Or, is this
> > somethig I'll have no choice but to take a class for? *smile*
> >
> > With All Respect,
> > Upshaw, LaMar T
> >
> > ----- Original Message -----
> > From: "Ken Perry" <whistler@xxxxxxxxxxxxx>
> > To: <programmingblind@xxxxxxxxxxxxx>
> > Sent: Monday, November 05, 2007 10:50 PM
> > Subject: RE: Beginning C and C++
> >
> >
> > >
> > >
> > > www.mingw.org for the mingw compiler it installs into a > > > c:\mingw\bin
> > > directory and you put it in your path and compile away.
> > >
> > > Ken
> > >
> > > -----Original Message-----
> > > From: programmingblind-bounce@xxxxxxxxxxxxx
> > > [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Lamar
Upshaw
> > > Sent: Monday, November 05, 2007 8:23 PM
> > > To: programmingblind@xxxxxxxxxxxxx
> > > Subject: Beginning C and C++
> > >
> > > Can anyone please suggest a very simple to use C compiler; > > > something
that
> > > would allow me to write code using a text editor, and then running
the
> > text
> > > file through the compiler?
> > >
> > > I've discovered I'll need to learn C, java, and more perl to work
with
> > > symbian.
> > >
> > > Until I can get hold of a better pc, I'm limited to using a pc
running
> > > windows ME, which is not my fault! lol *smile* I know I can run the
perl
> > > interpreter on here, but I'm not so sure abut C and java.
> > >
> > > Also, can anyone suggest a good place to start when it comes to
learning C
> > > for the first time? Something that's for dummies or idiots at > > > first?
> > *smile*
> > >
> > > With All Respect,
> > > Upshaw, LaMar T
> > >
> > > __________
> > > View the list's information and change your settings at
> > > //www.freelists.org/list/programmingblind
> > >
> > > __________
> > > View the list's information and change your settings at
> > > //www.freelists.org/list/programmingblind
> > >
> >
> > __________
> > View the list's information and change your settings at
> > //www.freelists.org/list/programmingblind
> >
> >
>
>
> --
> When you say "I wrote a program that crashed Windows," people just
> stare at you blankly and say "Hey, I got those with the system, for
> free."
> Linus Torvalds
> __________
> View the list's information and change your settings at
> //www.freelists.org/list/programmingblind
>

__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind




--
When you say "I wrote a program that crashed Windows," people just
stare at you blankly and say "Hey, I got those with the system, for
free."
Linus Torvalds
__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind



__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind

Other related posts: