I don't know, but I think we're supposed to do it using pointers and
srting arrays. I think I understand the concept of the two topics but
don't really know how to use them correctly. Here're a couple of my
guesses (keep in mind that the only libraries that I can use are
<iostream>, <cmath>, <cstdio>, and <cstring>, and maybe another that
I've forgotten):
//v.3
int i = 0;
for(fullName; fullName[i] != ' '; i++) {
strcat(title, i);
}
//v.4
char *i, j = 0;
for(j; j != ' '; j++) {
i = fullName[j];
strcat(title, *i);
}
yeah, pretty ugly, I know... Here's the compile error:
Error : function call 'strcat((lval) char *[10], (lval) char)'does not
match
'std::strcat(char *, const *)'
Credit.cpp line 75 strcat(title, i);
Bimor
Aggro <sp**********@yahoo.com> wrote in message news:<lF***************@read3.inet.fi>...
Bimo Remus wrote:
Hi, I am currently taking a C++ class and am having problems with a
homework assignment. My problem is that I need to pull the first and
last words out of of a character string array which is in the form
title firstName lastName. The chapter that this assignment is on
deals with string arrays and includes pointers. I've seen how one can
reverse the order of letters in a word using pointers so thought maybe
I could discern the last word from a phrase of an indeterminate number
of words by going to the last character and keep moving through the
characters backwards until i reach a ' '. Does anyone have any ideas
of where I could look?
Could you provide some code what you have done so far. Can you read the
first word from the string?