Results are out! Find what you need...fast. Get quick advice or join the chat
x

Unlock these great extras with your FREE membership

  • One-on-one advice about results day and Clearing
  • Free access to our personal statement wizard
  • Customise TSR to suit how you want to use it

need EMERGENCY C Programming help PLEASE

Announcements Posted on
Find your uni forum to get talking to other applicants, existing students and your future course-mates 27-07-2015
Win top prizes in our mega results day giveaway... 24-07-2015
  1. Offline

    ReputationRep:
    hi,

    i really need some help with this task which is due tomorrow at 5pm:
    the task asks us to Write a program to take in the names of 10 people, and find the longest name. Use the gets() function to take in the peoples names so that full names (including spaces) can be stored. You should be able to enter a name of 25 characters in length.

    many thanks in advance
  2. Offline

    ReputationRep:
    Erm, you won't learn anything if you get other people to do your homework for you.

    Post your code and a note of which bit of it isn't working.
  3. Offline

    ReputationRep:
    One tip I'll give you is never use the gets() function. Use fgets() instead.
  4. Offline

    ReputationRep:
    (Original post by JGR)
    Erm, you won't learn anything if you get other people to do your homework for you.

    Post your code and a note of which bit of it isn't working.
    i dont think i could write my code due to plagiarism ,i have done the 1st part but the only part im struggling with is finding the longest word ...i can't get the logic behind it and i don't know how to use strcpy.
    any help is appreciated
    thanx
  5. Offline

    ReputationRep:
    (Original post by arjun3)
    i dont think i could write my code due to plagiarism ,i have done the 1st part but the only part im struggling with is finding the longest word ...i can't get the logic behind it and i don't know how to use strcpy.
    any help is appreciated
    thanx
    Break it into smaller problems:
    1) Find the length of each name
    2) Find the highest length (a 'for' loop possibly)
  6. Offline

    ReputationRep:
    (Original post by JoMo1)
    Break it into smaller problems:
    1) Find the length of each name
    2) Find the highest length (a 'for' loop possibly)
    i've done that but my program still doesnt work ...
  7. Offline

    ReputationRep:
    (Original post by arjun3)
    i dont think i could write my code due to plagiarism ,i have done the 1st part but the only part im struggling with is finding the longest word ...i can't get the logic behind it and i don't know how to use strcpy.
    any help is appreciated
    thanx
    So you're using the string library, take a look at: this

    You will need to store the names into an array to start with, then go through that array checking each length using strlen and storing the length if it is bigger than the previously known largest. As previously suggested, use a for loop.

Reply

Submit reply

Register

Thanks for posting! You just need to create an account in order to submit the post
  1. this can't be left blank
    that username has been taken, please choose another Forgotten your password?
  2. this can't be left blank
    this email is already registered. Forgotten your password?
  3. this can't be left blank

    6 characters or longer with both numbers and letters is safer

  4. this can't be left empty
    your full birthday is required
  1. By joining you agree to our Ts and Cs, privacy policy and site rules

  2. Slide to join now Processing…

Updated: February 22, 2012
TSR Support Team

We have a brilliant team of more than 60 Support Team members looking after discussions on The Student Room, helping to make it a fun, safe and useful place to hang out.

Poll
Have you got a summer job this year?
Results and Clearing

Results are coming...

No sweat. Here's all you need to make sure you're ready

new on tsr

Cure summer boredom

Bargain games for under £20

Useful resources
x

Think you'll be in clearing or adjustment?

Hear direct from unis that want to talk to you

Get email alerts for university course places that match your subjects and grades. Just let us know what you're studying.

Quick reply
Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.