delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/09/27/22:35:11

X-Originating-IP: [24.169.88.178]
From: "Timothy M Boronczyk" <bluephoenixbeta AT hotmail DOT com>
To: djgpp AT delorie DOT com
Subject: help with strings
Date: Fri, 27 Sep 2002 22:35:06 -0400
Mime-Version: 1.0
Message-ID: <F16Y0emNoQgUtc2Ar7Y0000658b@hotmail.com>
X-OriginalArrivalTime: 28 Sep 2002 02:35:07.0312 (UTC) FILETIME=[A8841B00:01C26697]
Reply-To: djgpp AT delorie DOT com

I've been making tremoendous strides with help from the cprogramming.com 
tutorial (it may not be trustworthy, but it gives me an idea), Thinking in 
C++, and everyone here.  I've not only figured out cin and cout, but I've 
also successfully implemented do/while and for loops, switch/case and if 
statements, and creating functions and  passing, modifying, and correctly 
returning variables.  Now, my project calls for me to implement strings.  
But I'm left scratching my head between the tutorials and fidling around; 
what I think should work either errors out during compilation, or gets stuck 
in an endless loop.

I've tried:

char string_var[20];
cin.getline(string_var, 20, '\n');


I've even tried:

char string_var[20];
int count=0;

do
{
  cin>>char[count];
  count++;
} while ((count<20)!!(string_var[count-1]=='\n'))


As always, any help would be greatly appreciated.

-Tim

_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019