
January 27th, 2007, 01:45 PM
|
|
Registered User
|
|
Join Date: Jan 2007
Posts: 1
Time spent in forums: 21 m 31 sec
Reputation Power: 0
|
|
|
Strings in C
Hello, I am currently trying to pick up C for the Canadian Computing Comptetition in late February. My main problem I am having revolves around the use of Strings. I have read many tutorials on them, but they never seem to work for me. I currently have run into two different problems with strings:
1) The user inputs a word, lets say dog, I then would like to follow it with a conditional statement such as if. I would like that If statement to reflect something to be done when the word matches, i.e dog. If any one would be able to enlighten me on how to go about this it would be greatly appreciated. an ideal answer would include the declaration statement, the retreival code (and whether scanf or gets() makes a difference overall if there is no spaces entered) and lastly the If statement.
2) The user will input up to 10 words which are of length 10 with no spaces and i will have to analyze each letter in each word and compare it to another. I believe an array would be the best solution, but i would like insight. For example the user inputs 6 10-character words. I want to put this in a loop as to save space, but I seem to be unable to work the string arrays correctly. An Ideal solution would consist of the declaration statement(s), the retreieval or up to 10 10-character words, and how to isolate each letter individually to compare capitolization.
These are all of the problems I ahve currently ran into. If any one needs any clarification on anything i have previously said, please let me know. Any help is appreciated
Thank you
|