Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsOtherProgramming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old January 27th, 2007, 01:45 PM
wizzard21 wizzard21 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2007
Posts: 1 wizzard21 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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

Reply With Quote
  #2  
Old January 28th, 2007, 09:58 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information.
 
Join Date: Sep 2004
Location: Israel
Posts: 26,969 Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)  Folding Points: 342040 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342040 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342040 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342040 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342040 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342040 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 5 Days 15 h 9 m 16 sec
Reputation Power: 1556
here is good tutorial I found:
http://www.cprogramming.com/tutorial/c/lesson9.html
as you can see there, to compare strings use the strcmp function.

Reply With Quote
Reply

Viewing: ASP Free ForumsOtherProgramming Help > Strings in C


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway