Re: beginner string question

From: Sonoman (fcarpio_at_cse.fau.edu)
Date: 11/12/03


Date: Wed, 12 Nov 2003 04:41:59 -0500

Sorry but I gave the wrong info, I declared "temp" as a character array if
that makes a difference. I did use strings but they were breaking up in
between spaces, so now I am using getline() with char[] arrays.

"Sonoman" <fcarpio@cse.fau.edu> wrote in message
news:Skksb.11179$jA6.6383@bignews6.bellsouth.net...
> I am trying to do this:
>
> cin >> temp;
> if (temp == "n"){
> Then do something...
> }
>
> temp was declared as a string and the input I give at the prompt is n, but
> it skips the condition for the if statement when I think it should go into
> the if statement. I tried swithching to 'n' for the condition but it gave
me
> a compile error. The complete code is here:
>
> http://www.cse.fau.edu/~fcarpio/
>
> and the offending lines are in the person.cpp file line 66. I know it must
> be something simple, but I am failing to see it. There is no compiler
error.
>
> Thanks in advance.
>
>



Relevant Pages

  • Re: beginner string question
    ... > a compile error. ... Use std::string instead of plain C-style strings. ... If you declared temp ... result of comparing will be always false. ...
    (comp.lang.cpp)
  • Re: string I/O in binary file
    ... I don't see what advantage you think a C character array will give you. ... parts of the files might change size, so you read some strings of one size ... B-Tree implementation. ... be the first index of your matrix. ...
    (comp.lang.cpp)
  • Re: String() declaration?
    ... the temp array is holding strings ... Dim temp as String ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Problem with this text-sorting algorithm
    ... I need to write an algorithm which will sort an array of text strings ... I'd done the sort. ... Dim temp As String ...
    (microsoft.public.vb.general.discussion)
  • Re: humidifiers
    ... So if the temp goes up a couple of degrees, the strings will expand, ... I don't see your pitch test as diagnostic of anything. ...
    (alt.guitar.beginner)