Need your guidance, please.

Postby Maria on Thu May 11, 2006 7:20 am

I am sorry to post this twice but I think I had posted it to the wrong forum (development discussion).

------------------------------------------------------------------
Hi
I just started on Andy Harris' Palm programming book and am stuck at Chapter 2, challenge no. 3, "Ask the user for a word and convert that word into pig latin by extracting the first letter and adding it to the end of the word with "ay". For example, if the user enters "PocketC", the program shoudl return "ocketCPay". Don't worry about words that begin with vowels.

My problem is :-

1. Extracting a letter - I can only do so if I know the number of letters in the word the user chooses. If my number is more than the number of letters, it doesn't work.

2. Adding to the end of the word - I am completely stumped. I tried various codes but nothing seem to work.

Don't laugh too hard - here's what I have so far :-

string str;
main();
clear();

puts("StringLibrary\n");
while(str=gets("Please enter a word:")){
puts("nRight10=" + strright(str.10));
wait();
}
} //end main

Any help would be greatly appreciated.


Thanks!
Maria
 
Posts: 3
Joined: Thu May 11, 2006 4:45 am
Location: Singapore

Postby dbbotkin on Mon Jun 05, 2006 4:37 pm

Try strlen(string) to get the length of the word.
dbbotkin
 
Posts: 1
Joined: Mon Jun 05, 2006 4:37 pm
Location: USA


Return to PocketC for Palm OS KB

Who is online

Users browsing this forum: No registered users and 1 guest

cron