Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Manipulate String

Reply
Thread Tools

Manipulate String

 
 
chessc4c6
Guest
Posts: n/a
 
      04-08-2005
As part of a programming assignment, I am supposed to create a my own
toUpper and toLower class functions, This is my piece of code:

void Mystring::toUpper(char *s1){
char *cpy = theString = new char[strlen(s1)+1];
char lower = 'a';
char higher = 'A';
while(!s1++){
if(s1==lower)
s1=higher;
lower++
higher++;
}
}

and this is my returnString function:

char* Mystring::returnString(){
return theString ;
}

But when I return the string, I just get gibberish on the screen...can
someone please help me out and just guide me in the right direction

 
Reply With Quote
 
 
 
 
Marc Aguilera
Guest
Posts: n/a
 
      04-09-2005
"chessc4c6" <(E-Mail Removed)> wrote in message news:<(E-Mail Removed) roups.com>...
> As part of a programming assignment, I am supposed to create a my own
> toUpper and toLower class functions, This is my piece of code:
>
> void Mystring::toUpper(char *s1){
> char *cpy = theString = new char[strlen(s1)+1];
> char lower = 'a';
> char higher = 'A';
> while(!s1++){
> if(s1==lower)
> s1=higher;
> lower++
> higher++;
> }
> }
>
> and this is my returnString function:
>
> char* Mystring::returnString(){
> return theString ;
> }
>
> But when I return the string, I just get gibberish on the screen...can
> someone please help me out and just guide me in the right direction


the answer's in the book you took this code snip from.
Just that!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to manipulate chars inside string Andre C Programming 19 02-05-2010 01:01 PM
Manipulate HTML string as DOM Mike Gleason jr Couturier ASP .Net 3 03-28-2008 06:41 PM
manipulate string crovax75@hotmail.com C Programming 6 11-07-2005 04:21 AM
To manipulate or not to manipulate Dave C++ 1 01-22-2005 10:52 PM
manipulate string Chris Python 14 10-28-2003 09:37 PM



Advertisments