Here's my code so far:
# include <iostream>
using namespace std;
void addS( const char orig[], char plural[]);
int main()
{
char x[10];
char word[10];
cout << "Enter word: " << endl;
cin >> x;
addS(x, word);
cout << word << endl;
}
void addS(const char orig[], char plural[])
{
int index = 0;
while (orig[index] != NULL)
{
index++;
for ( int i = 0; i > index; i++)
{
plural[i] = orig[i] + 's';
}
}
}
When I run the program it gives me this:
Enter word:
school
╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠school
Press any key to continue . . .
I'm not sure what I did wrong. I think it might have to do with coping orig and then adding the s.
Thank you.
Rin

New Topic/Question
Reply



MultiQuote








|